为什么我这样写得不到aeiou,救救孩子吧
本帖最后由 刘光耀 于 2021-6-26 16:53 编辑#include <stdio.h>
int main()
{
int i=0,j=0,k=0,t=0,a=0;
char ch;
printf("请输入一串字符:");
while(ch=(getchar())!='\n')
{
if(ch == 'a' || ch == 'A')
i++;
else if(ch == 'e' || ch =='E')
j++;
else if(ch == 'i'|| ch == 'I')
k++;
else if(ch == 'o' || ch == 'O')
t++;
else if(ch == 'u' || ch == 'U')
a++;
else
continue;
}
printf("a(%d),e(%d),i(%d),o(%d),u(%d)\n",i,j,k,t,a);
return 0;
}
已解决
页:
[1]