解题思路:
注意事项:
参考代码:
#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++代码)浏览:1208 |
The 3n + 1 problem (C++代码)(所有测试数据都小于等于1000,,说好的1000000之内呢)浏览:1116 |
C语言训练-最大数问题 (C语言代码).........关于-1浏览:756 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:711 |
简单的a+b (C语言代码)浏览:787 |
C语言考试练习题_一元二次方程 (C语言代码)浏览:761 |
计算质因子 (C++代码)浏览:1777 |
简单的a+b (C语言代码)浏览:741 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:1212 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:601 |