第十三周 OJ平台-统计元音字母个数
2014-11-20 15:08
387 查看
题目描述
统计每个元音字母在字符串中出现的次数。输入
输入一行长度不超过100的字符串。输出
输出各个元音字母出现的次数,格式是(numx是数字):a:num1
e:num2
i:num3
o:num4
u:num5
问题及代码:
#include <iostream> #include <cstdio> using namespace std; int main( ) { char str[100]; int j=0,A=0,E=0,I=0,O=0,U=0; gets(str); while(str[j]!='\0') { if (str[j]=='a') A++; else if (str[j]=='e') E++; else if (str[j]=='i') I++; else if (str[j]=='o') O++; else if (str[j]=='u') U++; j++; } cout<<"a:"<<A<<endl; cout<<"e:"<<E<<endl; cout<<"i:"<<I<<endl; cout<<"o:"<<O<<endl; cout<<"u:"<<U<<endl; return 0; }
运行结果:
相关文章推荐
- 第十三周 oj平台 统计元音字母个数
- 第十三周 OJ平台 C:统计元音字母个数
- 第十三周 OJ平台统计元音字母个数
- 第十三周OJ平台(3):统计元音字母个数
- 第十三周OJ平台(3)统计元音字母个数
- 第十三周OJ项目统计每个元音字母在字符串中出现的次数。
- 第13周 OJ平台(统计每个元音字母在字符串中出现的次数)
- 第十三周OJ项目统计元音字母个数
- 第十三周OJ项目c:统计元音字母个数
- 第十三周oj平台项目三:统计元音字母
- 第十三周OJ项目3统计元音字母个数
- OpenJudge计算概论-求字母的个数(统计元音字母个数)
- 第十三周 OJ平台作业-数组逆序输出
- 字母统计(南阳oj241)(水题)
- 第十三周 项目5:统计字符串中大小写字母的个数
- 统计元音字母个数(31)
- 统计元音字母
- 第十三周项目5--统计字母A出现的次数
- 第十三周项目五:统计每一个字母的个数
- 南阳oj 题目241 字母统计