跳轉到內容

C++ 程式設計/程式碼/標準 C 庫/函式/isdigit

來自華夏公益教科書,開放的書籍,開放的世界
語法
#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 );
相關主題
isalnum - isalpha - iscntrl - isgraph - isprint - ispunct - isspace - isxdigit
華夏公益教科書