解题思路:
注意事项:
参考代码:
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
char c[1005];
gets(c);
int num1=0,num2=0,num3=0,num4=0;
for(int a = 0;a < strlen(c);a ++)
{
if(c[a]>='a'&&c[a]<='z')
num1++;
else if(c[a]>='A'&&c[a]<='Z')
num1++;
else if(c[a]>='0'&&c[a]<='9')
num2++;
else if(c[a]==' ')
num3++;
else
num4++;
}
printf("%d %d %d %d",num1,num2,num3,num4);
return 0;
}
0.0分
2 人评分
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:677 |
C语言训练-求素数问题 (C语言代码)浏览:1450 |
【数组的距离】 (C语言代码)浏览:728 |
拆分位数 (C语言代码)浏览:1324 |
计算质因子 (C++代码)浏览:1608 |
WU-复数求和 (C++代码)浏览:1995 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:581 |
蛇行矩阵 (C语言代码)浏览:524 |
sizeof的大作用 (C语言代码)浏览:1447 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:782 |