From 713378f9e8161b7a58c79254c6dd4168694be886 Mon Sep 17 00:00:00 2001 From: fdlt3917 Date: Mon, 23 Jan 2023 11:30:18 +0000 Subject: [PATCH] added looping function --- src/main/quizproject.c | 27 ++++++++++++++++++++++++++- src/main/quizproject.h | 3 +++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index f913985..46c20ac 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -60,7 +60,30 @@ void displayLifelineInstructions(void) { void displayInstructions(void) { displayWelcomeMessage(); displayLifelineInstructions(); - displayWelcomeMessage(); + displayGoodLuckMessage(); +} + +void looping(char qS[][100], char qC[][100], char aS[]){// 5 + + printf("\t\t--------------------Round 1-------------------\n\n"); + printf(">>In this round you need to answer 3 questions correctly to move to Round 2<<\n\n"); + char response; + for (int i = 0; i < 1; i++){ + printf("%s\n", qS[i]); + printf("%s\n", qC[i]); + 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 == aS[i]){ + score++; + printf("\nCorrect!\n"); + printf("You have %d points now\n\n", score); + + } else { + printf("\nwrong!\n"); + printf("You have %d points now\n\n", score); + } + } } void ask_questions(void) { @@ -79,6 +102,8 @@ void ask_questions(void) { 'A' }; + + looping(qS,qC,aS); } diff --git a/src/main/quizproject.h b/src/main/quizproject.h index f4a337c..14efb66 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -7,4 +7,7 @@ void displayLifelineInstructions(void); void displayInstructions(void); void displayGoodLuckMessage(void); void ask_questions(void); + +int score = 0; + #endif