C++ 编程/代码/标准 C 库/函数/isdigit
外观
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.
语法 |
#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 );