From 083d929018a4ad1c960cac663aa40e3c23576c80 Mon Sep 17 00:00:00 2001 From: fdlt3917 Date: Wed, 1 Feb 2023 07:42:11 +0000 Subject: [PATCH] million game - exits on wrong answer --- src/main/quizproject.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index f2bbcfa..093dcc2 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -660,6 +660,7 @@ void play_milliongame() { int million_i = 0; char million_user_answers[round]; char million_std_answers[round] = {'B', 'A', 'A'}; + int million_stay_in_game = 0; char questions[round][256] = { "What is the capital of France?", @@ -672,7 +673,7 @@ void play_milliongame() { { "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" }, }; - while(million_i < round){ + while(million_i < round && million_stay_in_game == 0){ printf("\n%s\n",questions[million_i]); for(int j=0;j<4;j++){ printf("%s\n",answers[million_i][j]); @@ -691,6 +692,7 @@ void play_milliongame() { } else{ printf("\nIncorrect!"); + million_stay_in_game == 1; } break; case 'B': @@ -699,6 +701,7 @@ void play_milliongame() { } else{ printf("\nIncorrect!"); + million_stay_in_game == 1; } break; case 'C': @@ -707,6 +710,7 @@ void play_milliongame() { } else{ printf("\nIncorrect!"); + million_stay_in_game == 1; } break; case 'D': @@ -715,6 +719,7 @@ void play_milliongame() { } else{ printf("\nIncorrect!"); + million_stay_in_game == 1; } break; default: