ユーザーが特定の時間内に数字を推測するプログラムを書きたいと思います。時間内に当てられなかった場合はタイムアウトとなり、最初からやり直しとなります。
お気に入り
main() {
int i, timer;
while(1) {
/* How to run the timer independently and it will signal that time out !!!*/
for(i = 0; i <= 10; i++) {
printf("\n Guess the value of i : ");
scanf("%d", &j);
if(i != j) {
printf("Bad Luck wrong Guess ");
}
else
printf("Great, You guessed correctly \n");
}
}
}
このプログラムでは、タイマーを実行する場所と方法がわかりません。私を助けてください。