View Single Post
Old May 8th, 2006, 10:05 AM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
* thwaps IR *

Bad, bad!

Use the cctype header instead of ctype.h - the former is a C++ library, and the latter is a C library. The only difference is that in the C++ version, everything is in the std namespace. As IR points out, this library contains a number of functions designed to do exactly what you want to do: isalpha checks whether the character passed to it is a letter, for example.

For punctuation, you'll have to check 'em manually:
switch (character)
{
    case '.':
    case '?':
    [...]
        // do stuff
        break;
}
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote