From 80c78a2de082faf068d9d666a0a83ddba6e44a7b Mon Sep 17 00:00:00 2001 From: fdlt3885 Date: Mon, 23 Jan 2023 11:43:01 +0000 Subject: [PATCH] added fifty fifty lifeline and function --- src/main/quizproject.c | 13 +++++++++++++ src/main/quizproject.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index efdfaac..c3e868f 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -72,6 +72,12 @@ void wrong(int score1){ printf("You have %d points now\n\n", score); } +void fifty_fifty(int question_num) { + char qC[][100] = {//6 + "A.Mount Everest\nB.Uludag", + }; + printf("%s\n",qC[question_num]); +} void looping(char qS[][100], char qC[][100], char aS[]){// 5 @@ -84,6 +90,13 @@ void looping(char qS[][100], char qC[][100], char aS[]){// 5 printf("Enter your answer (A, B, C, or D) or use a lifeline (F for 50/50, H for hint): "); scanf(" %c", &response); response = toupper(response); + if (response == 'F') { + fifty_fifty(i); + printf("Enter your answer (A, B, C, or D): "); + scanf(" %c", &response); + response = toupper(response); + } + if(response == aS[i]){ score++; correct(score); diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 5b20378..04b4301 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -7,6 +7,7 @@ void displayLifelineInstructions(void); void displayInstructions(void); void displayGoodLuckMessage(void); void ask_questions(void); +void fifty_fifty(int); void correct(int); void wrong(int); int score = 0;