题解 | 判断是元音还是辅音
判断是元音还是辅音
https://www.nowcoder.com/practice/7eb4df4d52c44d309081509cf52ecbc4
#include <stdio.h>
int main() {
char letter[10] = { 'A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u'};
char input;
int found = 0;
while (scanf(" %c", &input) == 1) {
int found = 0;
for (int i = 0; i < 10; i++) {
if (input == letter[i]) {
found = 1;
break;
}
}
if (found) {
printf("Vowel\n");
} else {
printf("Consonant\n");
}
}
return 0;
}
查看13道真题和解析