From 9ad02724a6b3a657b63328b74ce01ce9096e3a16 Mon Sep 17 00:00:00 2001 From: fdlt3885 Date: Mon, 23 Jan 2023 12:00:28 +0000 Subject: [PATCH] Added Hint function --- src/main/quizproject.c | 16 +++++++++++++--- src/main/quizproject.h | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index c3e868f..ac78335 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -96,6 +96,13 @@ void looping(char qS[][100], char qC[][100], char aS[]){// 5 scanf(" %c", &response); response = toupper(response); } + else if (response == 'H') { + hint(i); + printf("Enter your answer (A, B, C, or D): "); + scanf(" %c", &response); + response = toupper(response); + + } if(response == aS[i]){ score++; @@ -128,10 +135,13 @@ void ask_questions(void) { } +void hint(int question_num) { + char qC[][100] = {//6 + "The Tallest mountain is 8,849m." + }; + printf("%s\n",qC[question_num]); +} - - - int main(){ displayInstructions(); diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 04b4301..d23d32b 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -8,6 +8,7 @@ void displayInstructions(void); void displayGoodLuckMessage(void); void ask_questions(void); void fifty_fifty(int); +void hint(int); void correct(int); void wrong(int); int score = 0;