私はcを新しくしましたが、タイピングゲームを作成しようとしています。しかし、ifステートメントは機能せず、出力は「非ゼロステータス "。問題は、IDEによって原因である可能性があります、私はそれを把握することはできません、ありがとう。C ifステートメントError:ゼロ以外のステータスで終了しました
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main (void)
{
char start;
printf ("here is a typing game\n");
printf ("type any key to start\n");
scanf ("%c", &start);
void game()
{
int i;
char answer;
char type[20];
{
for (i = 0; i < 20; i++)
{
printf ("%c", 'a' + (random() % 26));
}
}
scanf ("%s", answer);
if (strcmp(answer,type) == 0)
{
printf ("good\n");
}
else
{
printf ("so bad\n");
}
}
game();
}
scanf( "%s"、&answer); –
Cでは、別の関数(この場合は 'main')の中で関数(この場合は' game')を定義することはできません。詳細については、Cマニュアルを参照してください。 – lurker