making sure only integer is input
- From: "Radith" <radith@xxxxxxxxxx>
- Date: Sat, 19 Nov 2005 14:52:53 +1300
Hi All,
I have a number guessing game in which users try to guess a random number.
Obviously, input is required of type int.
BUT, when a user inputs a string the program will result in an undesired
infinite loop.
Now, I know a string is not what we're after but in terms of error-handling;
How can we prevent users from entering a string?
and if we can't do that:
How can we make sure if a string is entered, it is realized and discarded.
Implying, that the user is warned about the mistake and prompted again in
hope of correct input this time??
I have not included my program here because it is unncessarily large (still
a begginer), but if y'all want; more than happy to attach it.
Thanks for all your time in advance.
.
- Follow-Ups:
- Re: making sure only integer is input
- From: Mark McIntyre
- Re: making sure only integer is input
- From: Simon Biber
- Re: making sure only integer is input
- From: vire
- Re: making sure only integer is input
- From: Jordan Abel
- Re: making sure only integer is input
- Prev by Date: Re: (: Pointer to struct withing pointer to struct :)
- Next by Date: Re: making sure only integer is input
- Previous by thread: Reboot a PC with C code
- Next by thread: Re: making sure only integer is input
- Index(es):
Relevant Pages
|