isdigit()函数是什么意思
is蟠校盯昂digit()函数意思:digit是数字的意思,isdigit就是判断是否是数字,0-9就是数字。如果isdigit函数包含在ctype.h头文件中,那字符串为数字。
计算过程:
原型: int isdigit(char c)。
用法:#include <ctype.h>。
功能:判断字符c是否为数字。
功能说明
/*找出字符串str中为阿拉伯数字0~9的字符*/
#include<iostream>
#include<cctype>
usingnamespacestd;
intmain()
{
stringstr="123@#FDsP[e?";
for(inti=0;str[i]!=0;++i)
{
if(isdigit(str[i]))
cout<<str[i]<<"isandigitcharacter"<<endl;
}
return0;
}
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:45
阅读量:22
阅读量:78
阅读量:84
阅读量:53