From 7e73a3dbbb2194f56769d397d8d601f52db9fccb Mon Sep 17 00:00:00 2001 From: fdlt3917 Date: Wed, 25 Jan 2023 09:32:52 +0000 Subject: [PATCH] added round two --- src/main/quizproject.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index ac78335..c679246 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -81,6 +81,8 @@ void fifty_fifty(int question_num) { void looping(char qS[][100], char qC[][100], char aS[]){// 5 +int k = 0; + while(k < 1){ 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; @@ -111,7 +113,45 @@ void looping(char qS[][100], char qC[][100], char aS[]){// 5 } else { wrong(score); } + if (score < 1) { + printf("You lost! Better luck next time\n"); + break; + } else { + printf("\t\t--------------------Round 2-------------------\n\n"); + printf(">>In this round you need to answer 2 questions correctly to move to Round 3<<\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 == 'F') { + fifty_fifty(i); + printf("Enter your answer (A, B, C, or D): "); + 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++; + correct(score); + + } else { + wrong(score); + } + } } + k++; + } +} + } void ask_questions(void) {