When I input an integer value using cin >> , how can I implement error-checking to make sure an integer was entered?
When I input an integer value using cin >> , how can I implement error-checking to make sure an integer was entered?
Well easy, just use the ctype.h
You can use isdigit() or isalpha() function
I also have the feeling you want to know how to check the size of the datatype that was used, you can use the sizeof keyword to do that...
ie: a = sizeof b;
those two things should help ya out
Last edited by Liam Battle; 04-28-2002 at 10:47 PM.
Search the board, it has come up before. Look up cin.good(), cin.bad(), cin.fail().