跳转到内容

The Wikibooks community is developing a policy on the use of generative AI. Please review the draft policy and provide feedback on its talk page.

C++ 编程/代码/标准 C 库/函数/isdigit

来自,开放的书籍,开放的世界

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
检索自 "https://wikibooks.cn/w/index.php?title=C%2B%2B_Programming/Code/Standard_C_Library/Functions/isdigit&oldid=3676203"
华夏公益教科书