题解1:
#include <stdio.h>
int main()
{
char arr[] = {'a','e','i','o','u','A','E','I','O','U'};
char a = 0;
while(~scanf("%c", &a))
{
int m = 0;
int i = 0;
for (i = 0; i < 10 ; i++)
{
if(a == arr[i])
{
m = 1;
}
}
if(m == 1)printf("Vowel\n");
else printf("Consonant\n");
getchar();//拿走缓冲区中的\n
}
return 0;
}
题解2:
#include <stdio.h>
int main()
{
char arr[] = {'a','e','i','o','u','A','E','I','O','U'};
char a = 0;
while(~scanf(" %c", &a))//跳过空白字符,\n属于空白字符
{
int m = 0;
int i = 0;
for (i = 0; i < 10 ; i++)
{
if(a == arr[i])
{
m = 1;
}
}
if(m == 1)printf("Vowel\n");
else printf("Consonant\n");
}
return 0;
}