Is there a way to validate a character like how we validate an integer using isdigit/cin.fail()?
eg.
main(){
char code; int num;
cin >> code; // where here i enter a string, say ert instead of e.
cin >> num;
}
If i enter a string instead of just 1 character, the following statement will be skipped.
is there a possible way to validate a character input?
No. The two characters that you entered after 'e' remain in the input buffer and will be read next time you ask for input.