Re: why isn't this working
Quote:
Originally posted by archie
why isn't my program working??
char ch;
int countspace=0;
cout << "Please enter a line of text, ";
cout << "followed by a return: ";
cout << endl;
cin.get(ch);
while (ch == '\n')
{
if (ch == ' ')
countspace++;
if(countspace > 0 && ch != ' ')
ch= toupper(ch);
cout <<ch;
countspace = 0;
}
You are only calling get() once...therefore it will work for 1 char....not a string......
Also, you would do better to identify the exact problem you have......."This doesnt work" is not very helpful