Mail Archives: djgpp/2000/05/22/15:58:32
Hey, thank you for reading my message, I'm having problems with a little
educational program I wrote,
The magic number is obviously five, but when it is entered, like any
other value,
guess the magic number *beeep*
guess the magic number *beeep*
is displayed.
#include <stdio.h>
void main(void)
{
int stop;
while ((stop=getchar())!= 5)
{
printf("Guess the magic number\n\a");
stop=getchar();
}
}
I tried using two variables, one a char;, and atoi, but the the same
results were encoutered. I also tried removig all references pertaining
to "getchar", declaring the while loop "while(stop !=5)", and using
"scanf" in the body of the loop, but to no avail.
Is this a bug (?) or am I a moron (most likely)?
Thank you much for your time
---dave
- Raw text -