// Take a look at the ascii character subtype recognizers. #include using namespace std; char bit(int x){ return x == 0 ? '0' : '1'; } /* Print first a list of the recognizer functions, then the ascii char codes (0 thru 127), each followed by marks indicating which of the recognizer functions they satisfy, followed (if printable char) by the print representation of the character. */ main() { char c; cout << "codes: " << endl; cout << " d - isdigit" << endl; cout << " x - isxdigit" << endl; cout << " l - islower" << endl; cout << " u - isupper" << endl; cout << " a - isalpha" << endl; cout << " n - isalnum" << endl; cout << " s - isspace" << endl; cout << " c - iscntrl" << endl; cout << " p - ispunct" << endl; cout << " r - isprint" << endl; cout << " g - isgraph" << endl; cout << " a - isascii" << endl << endl; cout << " dxluanscprga" << endl; for(int c = 0; c < 128; ++c) { cout.width(3); cout << c << ": " << bit(isdigit(c)) << bit(isxdigit(c)) << bit(islower(c)) << bit(isupper(c)) << bit(isalpha(c)) << bit(isalnum(c)) << bit(isspace(c)) << bit(iscntrl(c)) << bit(ispunct(c)) << bit(isprint(c)) << bit(isgraph(c)) << bit(isascii(c)); if (isprint(c)) cout << " " << static_cast(c); cout << endl; } cout << " dxluanscprga" << endl; }