-
May 21st, 2012, 12:18 PM
#11
Re: how to count double characters ?
Originally Posted by bekim
i did some modifications :
#include <iostream>
using namespace std;
int main ()
{
int numDoubles = 0;
char text[30];
cout<<"Enter sentence: ";
cin.getline(text,30);
for (int i = 0; i<(text[30]); i++)
if (isalpha(text[i]) == isalpha(text[i+1]))
numDoubles++;
cout << "There is "<< numDoubles << " character double.";
cin.get();cin.get();
return 0;
}
but it still dont work the output is always 0
Now you're just guessing. Instead of writing nonsense, you should correct the mistake I pointed out. I showed you the correct spelling. I don't know how much simpler to make it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|