Im designing a program in which i need to check if the next char taken from a line of input is a letter. How would i do this with just the standard functions?
Im designing a program in which i need to check if the next char taken from a line of input is a letter. How would i do this with just the standard functions?
char letter;
cin >> letter;
if( (letter >= 'A' || letter <='Z') || ( letter >= 'a' || letter <= 'z' ) )
{
//continue as planned
}
else
{
arrgggg!!! not a letter, abort abort!!!!!!
}
or there is a function isalpha( int ) in ctype.h ehich does the same thing
Sorry unregistered, but your code will aways result in the if statement being true. Anything inputed is either greater 'A' or less than 'Z'. You needed an && instead of ||.
Anyways, just use isalpha().
If a tree falls in the forest, and no one is around to see it, do the other trees make fun of it?