| DontSeeMinusMinus (16) | |||
What else should I write to make the user enter the number again if he types a decimal number. How do I add a message if the number is negative or decimal? For example. Enter number 1 -> -1 Negative number! Enter number 1 -> 0.1 Decimal number! Enter number 1 -> 2 Enter number 2 -> 3 Thank you very much for your help. | |||
|
|
|||
| Zereo (178) | |||
The simple way to do it is this.
This is the simple way of doing things. If the user enters a negative number it prompts the user to enter a new number. He he enters one again it closes the program since the user is stupid ;p. There are far better ways to handle user errors and errors in general but this will give you a simple example. | |||
|
Last edited on
|
|||