/* * @topic T00205 if-else ladder * @brief C++ library character characterization functions */ #include <iostream> int main( ) { std::cout << "type a character: "; char ch; std::cin >> ch; // isalpha // isdigit // ispunct // isspace // isupper // islower if ( isalpha( ch ) ) { std::cout << "alpha "; } else if ( isdigit( ch ) ) { std::cout << "digit "; } else if ( ispunct( ch ) ) { std::cout << "punctuation "; } else { std::cout << "neither of the above "; } return 0; }