Count the number of occurrences of sequences of N (acquired through user input) or more consecutive 'T's in a string consisting of the characters a,c,g, and t, and report this as a whole number. For example, actttaattttactttcctta has 3 poly-t sequences of length 3 or more, and only one of length 4 or more.
Requires string length() member, subscripting on C++ string object, for-loop, and if-statement.
char x[80];
int i, n=0;
cin>>x; //read the string.
for(i=0;x[1]!='\0';i++)
{
if( x[i]!='t') {
if(n) cout<<n<<endl;
n=0;
}
else
{
if(x[i+1]=='t')n++;
Firstly, use code tags and don't forget to indent (if it doesn't do it automatically).
Secondly, if you're using C++ to solve your problem, use string objects (see http://www.cplusplus.com/reference/string/string/ ), char* are C specific and not C++.