题目内容
修改程序下面程序中均有2处错误,阅读程序并上机调试,不增加程序代码行,修改程序,使程序能够正确运行。(1)功能:输入一行字符,以换行符结束,分别统计出其中英文字母、空格、数字和其它字符的个数。例如:输入:qwe123 ASD+-*# wer输出:char=9 space=2 digit=3 others=4#include void main(){char c;int letters=0,space=0,digit=0,others=0;printf("please input some characters\n");while(c=getchar()=='\n'){if(c>='a'&&c<='z'&&c>='A'&&c<='Z')letters++;else if(c!=' ')space++;else if(c>=0&&c<=9)digit++;elseothers++;}printf("char=%d space=%d digit=%d others=%d\n",letters,space,digit,others);}
查看答案
搜索结果不匹配?点我反馈
更多问题