R
Radith
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.
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.