-
while loop problem
I'm trying to create a while loop with an 'or'.
The program runs fine without the 'or' but when I add it, the program outputs nothing. Here is the loop in question:
Code:
while ( (sentence[pos] != ' ') || (sentence[pos] != '.') )
{
count++;
pos++;
}
I want it to execute the loop while sentence[pos] is not a space, or a period. When I add in then part about not being a period, it seems to kill the loop. Is this improper syntax?
-
It's all the english :)
You want to execute the loop while sentence[pos] is not a space and not a period.
-
Wow, don't I feel stupid now. Thanks a lot, I think thats the second or third time you've helped me. :)