In the program i am writing, it asks the user to type 1 for this menu, 2 for this, and 3 for another. If the user types anything but 1, 2, or 3, it will go back to the previous menu instead. However i have a problem. If the user types a letter instead of a number, the program simply terminates. To fix this i tried making the variable to hold the menu choice a Char. Now when i did this, it would go back to the previous menu correctly, but if the user typed 1 2 or 3 to go do different menus, it wouldn't go to them...it would just go back to the previous menu instead, without performing the functions called by menu 1 2 or 3. This is really ........ing me off.. any ideas?
Nevermind, i figured it out ;)
I just included <string> and defined the menu choice variable as a string.
Maybe if you want you can try and use a character array, instead of using a string, therefore giving a little bit more protection for what the user inputs.