Hi again........
of course there's another way to solve this...remember C++ is a very very powerful language....
just an update:
the reason why a program accepts the input 1111a is because the comparisons that you are doing pertain to "NUMBERS" not characters... so if you first enter a number followed by a character then the compiler will read only the numbers and if it encounters a characters it will ignore the rest....however if you will START with a character your loop most likely will become infinite and go on forever....
the way to fix it is to send it to another function (right before it enters the loop) to have it examine the statement piece by piece whether it is a chracter or a number....
--- first of all you would have to include another header file called
.......... ctype.h ............
- the function that would check for a character is ........ isalpha(char SomeLetterGoesHere)............. --- this function would return TRUE if your character is a letter...
- the function that would check for a number is ....... isdigit(char SomeCharacterGoesHere) ............. --- this function would return TRUE if your character is a "DECIMAL" digit ....
hope this helps a little bit....
.... the only problem is that if you would have to "CAST" the integer so it would become a "STRING" or an array of character so that this function can examine your input "character-by-character" and then cast it back to a INTEGER ....
well, as you can see, there's a lot more work involved in this...
but don't get discouraged....
Regards,
matheo917