用一个for循环来遍历字符串中的内容然后比较是否为 aeiou 最后得出结果
以下是运用上面的前辈写的 哈哈
#include "stdafx.h"
#include"iostream"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char str[]="a111a111e111i11o111u";
char *cpstr=str;
int sum=0;
while(*cpstr!='\0')
{
switch(*cpstr)
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
sum++;//累加aeiou的个数
default:{
break;}
}
cpstr++;
}
cout<<sum;
return 0;
}
温馨提示:答案为网友推荐,仅供参考