Does not like my while statement. Help
How to fix?
do
{
/* several statements all work correctly */
printf("Enter 'X' to exit program\n);
scanf( " %c", &option);
while (option != 'X' || option != 'x')
}
tia
Otto
Sorry about the lack of tags.
Does not like my while statement. Help
How to fix?
do
{
/* several statements all work correctly */
printf("Enter 'X' to exit program\n);
scanf( " %c", &option);
while (option != 'X' || option != 'x')
}
tia
Otto
Sorry about the lack of tags.
That isn't the syntax for a do...while loop. First you have do, then a statement or compound statement, while, and a semicolon:
Your code (assuming you've omitted nothing important) should be:Code:do statement while (condition);
Code:do { printf("Enter 'X' to exit program\n); scanf( " %c", &option); } while (option != 'X' || option != 'x');
My best code is written with the delete key.
Guys,
Shame on me. I guess I was tired etc.
Happens when trying a new language.
Thanks again.
Otto