解题思路:
注意事项:
参考代码:
#include<iostream>
#include<ctype.h>
#include<string.h>
using namespace std;
int main()
{
int a=0,b=0,c=0,d=0;
char str[1000];
gets(str);
for(int i=0;i<strlen(str);i++){
if(toupper(str[i])>='A'&& toupper(str[i])<='Z')
a++;
else if(str[i]==' ')
b++;
else if(str[i]>='0'&&str[i]<='9')
c++;
else d++;
}
cout<<a<<endl<<b<<endl<<c<<endl<<d;
return 0;
}
0.0分
0 人评分
C语言训练-求矩阵的两对角线上的元素之和 (C语言代码)浏览:754 |
输出正反三角形 (C语言代码)格式错误!!!浏览:1175 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:624 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:588 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:707 |
IP判断 (C语言代码)浏览:585 |
分糖果 (C语言代码)浏览:974 |
模拟计算器 (C语言代码)浏览:2343 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:392 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:534 |