I'm trying to make some error messages in my program in case a user tries to input a string or character in an int.
Only problem now is if the user inputs something like "45ygiabg".
As long as user enters a number at first, the number will be inputted and the rest are in the input buffer.
My question now is: how do I give an error to an input like that?
I want my program to run only if JUST numbers are entered.. Is there a way to do that?
You could read in either the whole token or the whole line as a string, and see if there are any non-digit characters in it. Then you can use traditional methods to convert the string to a number.