c语言的小问题 对我很重要 请各位帮帮忙!!谢谢!!

来源:百度知道 编辑:UC知道 时间:2024/06/14 01:17:04
输入一个字符串(以换行符号'\n'作为结束标志)统计其中数字(0,1,2,....,9不单独统计)、空白和其他字符出现的次数。请在程序中空格处填空。
# include"stdio.h"
main()
{ char c;
int ___________________;
while((c=getchar())!='\n')
{ if (________________) digit++;
else if(c==' '||c=='\t') blank++
else_____________;
}
printf("digit=%d,blank=%d,other=%d\n",digit,blank,other);
}

digit=0,blank=0,other=0
c <= '9' && c>='0'
other++
结果已经经过验证,楼主的第一个else if 语句,后面应该还有一个“;”的!

digit,blank,other
c>=0 && c<=9
other++

digit=0,blank=0,other=0
c <= '9' && c>='0'
other++