Is it really that hard?
I don't know if that takes a string or not, but if it's only a character then just loop through.
If isalpha() failes it does not mean that the character is a numeric digit, it could be anything else too. If you want to check for numeric digits then use isdigit(). And both only check one character, so if you have a whole string then you must check each character individually.
If you want to make sure there are no numbers in a string, you can do a find_first_of( "01234567890"). If it equals anything other than string::npos, it's got a number in there.
what if we dont have to use library functions.
Well, in that case just do it the hard way -- put this in a loop
if( string[i] >= '0' || string[i] <= '9' )
We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.