Date: Thu, 23 May 2002 22:38:08 +0000 From: "echo dev" <echo_dev@hotmail.com> To: hackers@freebsd.org Message-ID: <F107VCxPcnietfhTGBe00009c91@hotmail.com>
next in thread | raw e-mail | index | archive | help
I know this is not about freebsd but i have noticed you guys are quit good
at C and i am a new learner of the language. I am codeing a number guessing
game all you do is pick a number between 1 and 136.. Now the problem is when
the player answers it correctly it ouputs would you like to play again..
When it prompts for your answer it automaicly acwers it self.I figured out
why it does is becuse there a values still in the keyboard buffer so i used
fflush(stdin); to get rid of them but fflush(stdin); did not work so i put
in an extra scanf statement right before the printf and scanf so it looks
like this:
scanf("%c", &qNa);
printf("WOULD YOU LIKE TO PLAY AGAIN?(y/n)>");
scanf("%c", &qNa);
is there anyone that might know why the fflush did not work???? I fugre this
works besuse it shoves an empty vale into the buffer thus casuseing it to be
empty.....
Dan
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F107VCxPcnietfhTGBe00009c91>
