u am accepting a single character from the user. how do i test the value entered if it was a number
problem
Started by hbk, Mar 26 2010 12:55 PM
2 replies to this topic
#1
Posted 26 March 2010 - 12:55 PM
|
|
|
#2
Posted 26 March 2010 - 04:09 PM
read up on the functions in the ctype.h header file... You may need isalpha() and isdigit(). Assuming you are using C. C++ may have something similar. (I dont know c++)
Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:
#3
Posted 26 March 2010 - 08:45 PM
you can use
if (!(cin >> var_x){
// do stuff if it's not and int when your var was declared an int, or ...
}


Sign In
Create Account


Back to top









