数据较大,考虑用getchar()将字符一个一个接受判断
include
include
include
include
include
int main()
{
char c;
int cnt=0;
c=getchar();
if(c>=48&&c<=57)
cnt++;
while(c!=’\n’&&c!=’\r’)
{
c=getchar();
if(c>=48&&c<=57)
cnt++;
}
printf("%d\n",cnt);
}
为什么错误呀
用getline处理,可能有空格,你这样输入中间就断了