Problem Description
统计一个句子中元音字母(a、e、i、o、u)的个数。
Input Description
在一行中输入一个英语句子。
Output Description
输出统计出的元音字母的个数。
Sample Input
And that's the way it is.
Sample Output
6
#include <stdio.h>
#include <ctype.h>
int main(void)
{
int sum = 0;
char ch;
scanf("%c", &ch);
ch = toupper(ch);
while (ch != '\n')
{
switch (ch)
{
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
sum = sum + 1;
scanf("%c", &ch);
ch = toupper(ch);
break;
default:
scanf("%c", &ch);
ch = toupper(ch);
break;
}
}
printf("%d", sum);
return 0;
}