#include <cctype> int isdigit( int ch );
isdigit() 函式如果其引數是 0 到 9 之間的數字,則返回非零值。否則,返回零。
char c; scanf( "%c", &c ); if( isdigit(c) ) printf( "You entered the digit %c\n", c );