#include <stdio.h>
int vowel_count(char n[]){
int hasil = 0;
char vowel[] = "aiueoyAIUEOY";
for (int i = 0; i < 50; i++)
{
for (int x = 0; x < 12; x++)
{
if (n[i] == vowel[x])
{
hasil++;
}
}
}
return hasil;
}
int main(void){
int amount;
char values[50], unknown[10];
char vowel[] = "AIUEOYaiueoy";
FILE* fp = fopen("zValues.txt", "r");
fscanf(fp, "%d", &amount);
fgets(unknown, 10, fp);
for (int n = 0; n < amount; n++)
{
fgets(values, 50, fp);
printf("%d ", vowel_count(values));
}
fclose(fp);
}
这是 zValues.txt:
5
胡言乱语
梨树
oa kak ushakov lil vo kashu kakao
我的 pyx
危险的赫玛万
当我运行代码时,它显示:
5 4 13 12 12
看到问题了吗?这是错误的答案”输出必须是这样的
5 4 13 2 5