给你个例子参考:示例:使用isdigit判断给定字符是否为0~9的数字。#include<iostream.h>#include<ctype.h>int main(){char c1='A';char c2=‘1’;if (isdigit (c1)!=0 )cout<<c1<<" is the valid digit!"<<endl; //当c1为0~9d的数字时,打印信息elsecout<<c1<<" is not the valid digit!"<<endl; //当c1为非0~9d的数字时,打印信息if (isdigit (c2)!=0 )cout<<c2<<" is the valid digit"<<endl; //当c1为0~9d的数字时,打印信息elsecout<<c2<<" is not the valid digit!"<<endl; //当c1为非0~9d的数字时,打印信息return 0;}