: I am doing a small research on error correction for wrong data types and would like your contributions if any. What would you do to prevent your program from crashing when the user enters an alphabetic character instead of an integer.(more to come later)
This has been covered several times on this board.
The best thing to do [IMHO] is to PREVENT the user from entering the wrong type of data. This can be done by capturing individual keystrokes as CHARs and testing them for propriety BEFORE submitting them to processing routines. The easiest way to test them for propriety is use the "in" operator and have a set of proper keys. e.g. for numbers your set would be ['0'..'9', #08, #13] allowing for backspace and enter. So, you capture individual keystrokes and then construct a string AFTER testing for set membership. HTH