解题思路:
直接干
注意事项:
while((c=getchar())!='\n')中括号数量;(c>='0'&&c<='9')数字也要加符号
参考代码:
#include<stdio.h>
int main()
{ int space=0,number=0,character=0,other=0;
char c;
while((c=getchar())!='\n')
{
if(c==' ') space++;
else if(c>='0'&&c<='9') number++;
else if(c>='a'&&c<='z'||c>='A'&&c<='Z') character++;
else other++;
}
printf("%d\n%d\n%d\n%d\n",character,space,number,other);
}
0.0分
0 人评分
不需要数组和指针的做法!!!浏览:1129 |
【作业调度方案】 (C语言代码)浏览:1090 |
2005年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:728 |
C语言训练-8除不尽的数 (C语言代码)暴力解法,答案只有一个,直接输出就好了浏览:1018 |
C二级辅导-同因查找 (C语言代码)浏览:565 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:958 |
C语言训练-列出最简真分数序列* (C语言代码)浏览:507 |
C语言训练-数字母 (C语言代码)浏览:586 |
ASCII帮了大忙浏览:751 |
程序员的表白 (C语言代码)浏览:669 |