From 5c3c80d7fd5b3f2ec87098bbaee9fd87c9bad816 Mon Sep 17 00:00:00 2001 From: fdlt3885 Date: Wed, 1 Feb 2023 22:17:41 +0000 Subject: [PATCH] added round 5 function and header to epic game --- src/main/quizproject.c | 31 +++++++++++++++++++++++++++++++ src/main/quizproject.h | 1 + 2 files changed, 32 insertions(+) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 9d23a8a..8a17a4b 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -1163,6 +1163,36 @@ int B_round4(void) { return score; } +int B_round5(void) { + int score = 0; + char answer[20]; + printf("Round 5\n"); + printf("Question 1: Who invented the World Wide Web?\n"); + printf("Options: a.)Bill Gates b.)Steve Jobs c.)Tim Berners-Lee d.)Mark Zuckerberg"); + printf("Answer: "); + scanf("%s", answer); + + if (strcmp(answer, "c") == 0) { + printf("Correct!\n"); + score++; + } else { + printf("Incorrect. The answer is c.\n"); + } + + printf("Question 2: Who was the first person to walk on the Moon?\n"); + printf("Options: a.)Neil Armstrong b.)Buzz Aldrin c.)Michael Collins d.)Pete Conrad"); + printf("Answer: "); + scanf("%s", answer); + + if (strcmp(answer, "a") == 0) { + printf("Correct!\n"); + score++; + } else { + printf("Incorrect. The answer is a.\n"); + } + return score; +} + void b_epic_game() { B_displayWelcomeMessage(); b_entertostart(); @@ -1176,6 +1206,7 @@ void b_epic_game() { total_score += B_round2(); total_score += B_round3(); total_score += B_round4(); + total_score += B_round5(); } diff --git a/src/main/quizproject.h b/src/main/quizproject.h index ad8ed92..26097cc 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -58,6 +58,7 @@ int B_round1(void); int B_round2(void); int B_round3(void); int B_round4(void); +int B_round5(void); #define NUM_QUESTIONS 5 #define round 15