您的位置:首页 > 其它

第十三周OJ项目统计元音字母个数

2014-11-20 15:11 344 查看
/*
*Copyright (c)2014,烟台大学计算机学院
*All gight reserved.
*文件名称:temp.cpp
*作者:曾晓
*完成时间:2014年11月17日
*版本号:v1.0
*/

#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char ch[100];
int i=0,n1=0,n2=0,n3=0,n4=0,n5=0;
gets(ch);
while (ch[i]!='\0')
{
if (ch[i]=='a')
n1++;
else if (ch[i]=='e')
n2++;
else if (ch[i]=='i')
n3++;
else if (ch[i]=='o')
n4++;
else if(ch[i]=='u')
n5++;
i++;
}
cout<<"a:"<<n1<<endl;
cout<<"e:"<<n2<<endl;
cout<<"i:"<<n3<<endl;
cout<<"o:"<<n4<<endl;
cout<<"u:"<<n5<<endl;

return 0;
}


运行结果:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: