verify user input

Hello all,

I would like to verify if a user input is of a certain type.
Say, I would like to make sure that a user only enters integers, or characters.
Is there an easy way to do so?

Thanks for your help
Two commonly used functions to check for alphanumerics:
1
2
int isalpha ( int c );
int isdigit ( int c );


both functions are defined in ctype.h of the C library. If you want them on a C++ program, you need to do: #include<cctype>

more information:
http://www.cplusplus.com/reference/clibrary/cctype/isalpha.html
http://www.cplusplus.com/reference/clibrary/cctype/isdigit.html
Topic archived. No new replies allowed.