input validiation

I am making a numbered menu system
1. caterer
2. decorate
3. entertain
4. quit

how would i go about checking to see if the user input a letter? i keep getting thrown into an infinite loop of the menu.

thanks

-vexstorm
Assuming you are using cin to get input, just dump the input into a string, then look at the string to determine if it is 1-4 or something else. Generally all text-based user input should be received as a string and then processed if you want to do any kind of error checking on it.
An alternative to strings could be stringstreams so that they could be easily converted back to numbers
Topic archived. No new replies allowed.