目录
1.思路解析
首先,用一个数组来。接收判断信息(A,E,I,O,U,a,e,i,o,u),用循环实现连续输入
(注意:输入的是字符所以要回车也会被当做字符接收进去)而后判断元音还是辅音
2.代码实现
#include <stdio.h>
int main()
{
char i = 0;
char ch[] = { 'A','E','I','O','U','a','e','i','o','u' };
while ((scanf("%c", &i)) != EOF)
{
while (1)
{
char b=getchar();
break;
}
int a = 0;
for (a = 0; a < 10; a++)
{
if (i == ch[a])
{
printf("元音\n");
break;
}
}
if (a == 10)
{
printf("辅音\n");
}
}
}
3.实现知识
判断语句
for循环遍历数组的每一个数
通过循环来实现连续输入
getchar()读取最后'\n'的字符防止代码出错误