Validating c input Looking for sexchat
This is extremely important because, an unhandled wrong input might have the complete ability to crash a system.C has some good validation techniques that can be used to validate most kind of inputs.
Should I separate string and integer validation into separate methods?My question is: What is the best way to validate input so it doesn't crash the program??? For example, if I enter "ffff", it will output: "Enter choice: Enter choice: Enter choice: Enter choice: " If I enter "fff" it will show "Enter choice: " three times. That is because cin is trying to read the f's one character at a time, because only one letter fits into char.