From 83acba955addbdaea76791d411c79a49458a7ce9 Mon Sep 17 00:00:00 2001 From: fdlt3859 Date: Wed, 25 Jan 2023 10:38:51 +0000 Subject: [PATCH] created hard questions function with Round 4 --- src/main/quizproject.c | 44 ++++++++++++++++++++++++++++++++++++++++++ src/main/quizproject.h | 3 +++ 2 files changed, 47 insertions(+) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index ee66202..8ad051e 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -169,6 +169,47 @@ void ask_questions(void) { } +void ask_hard_questions(void) { + + + int k = 0; + while (k < 1) { + + printf("\t\t--------------------Round 4-------------------\n\n"); + printf(">>In this round you need to answer 2 questions correctly to move to Round 5<<\n\n"); + + + char questions[NUM_QUESTIONS][256] = { + "What is the capital of France?", + "Who was the first president of the United States?" + }; + char options[NUM_QUESTIONS][4][256] = { + { "A) Berlin", "B) Paris", "C) London", "D) Rome" }, + { "A) George Washington", "B) John Adams", "C) Thomas Jefferson", "D) James Madison" } + }; + char answers[NUM_QUESTIONS] = { 'B', 'A'}; // correct answers (A, B, C, or D) + + + char user_answers[NUM_QUESTIONS]; // to store user answers (A, B, C, or D) + + for (int i = 0; i < 2; i++) { + + + printf("[%d] %s\n", i + 1, questions[i]); + for (int j = 0; j < 4; j++) { + printf("%s\n", options[i][j]); + + + } + + } + + + k++; + } +} + + void hint(int question_num) { char qC[][100] = { "The Tallest mountain is 8,849m." @@ -193,6 +234,9 @@ int main(){ } printf("\n"); ask_questions(); +if (score > 2){ + ask_hard_questions(); +} displayThankYouMessage(); return 0; } diff --git a/src/main/quizproject.h b/src/main/quizproject.h index bd5a2a6..89328cb 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 ask_hard_questions(void); void fifty_fifty(int); void hint(int); void correct(int); @@ -15,4 +16,6 @@ int score = 0; void printOutOption(char [][100], char [][100],char []); void displayThankYouMessage(void); +#define NUM_QUESTIONS 5 + #endif