From df0ea8ae0972f85a063e729e2f338a349b4edbf9 Mon Sep 17 00:00:00 2001 From: fdlt3914 Date: Fri, 27 Jan 2023 21:20:21 +0000 Subject: [PATCH] refactoring: more hard question --- src/main/quizproject.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 9361d04..8cc1af0 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -4,7 +4,7 @@ #include #include #include "quizproject.h" -char answers[NUM_QUESTIONS] = {'B', 'A', 'A','B'}; +char answers[NUM_QUESTIONS] = {'B', 'A', 'A','B','A'}; int* randomNumber() { srand(time(NULL)); @@ -58,7 +58,7 @@ void displayGameInstructions(char vorName[], char nachName[]) { printf("\t\t------------------------------------------\n\n"); printf("\t\t------------------------------------------\n\n"); printf("\t\t Hello %s %s! \n\n", vorName, nachName); - printf("\t\t To start this game, here are the Game Instructions\n\n"); + printf("\t\t To start this game, here are the Instructions\n\n"); printf("\t\t------------------------------------------\n"); printf("\t\t------------------------------------------\n\n"); printf("\t\tYou will be presented with questions from Round 1(Super Easy) to Round 5(Very Hard).\n"); @@ -116,7 +116,8 @@ void hintForHardQuestions(int question_num) { "The city is known for its iconic landmarks and romantic atmosphere.", "He was a general in the American Revolutionary War and is considered the Father of His Country.", "This team has won the most NBA championships in history, with a total of 16 championships.", - "It is the lightest and most abundant chemical element in the universe." + "It is the lightest and most abundant chemical element in the universe.", + "This South Korean film became the first non-English language film to win the Academy Award for Best Picture." }; printf("Hint: %s\n", hints[question_num]); } @@ -126,7 +127,8 @@ void fifty_fifty1(int question_num) { { "A) Berlin", "B) Paris", "C) London", "D) Rome" }, { "A) George Washington", "B) John Adams", "C) Thomas Jefferson", "D) James Madison" }, { "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" }, - { "A) He", "B) H", "C) O", "D) Ne" } + { "A) He", "B) H", "C) O", "D) Ne" }, + { "A) Parasite", "B) Joker", "C) Once Upon a Time in Hollywood", "D) 1917" } }; char correct_answer = answers[question_num]; int num_incorrect = 0; @@ -241,7 +243,7 @@ void ask_questions(void) { "What is the capital of Thailand?\n", "In which country was Frida Kahlo born?\n", }; - char possible_options[][100] = {//6 + char possible_options[][100] = { "A.Mount Everest\nB.Uludag\nC.K2\nD.Makalu", "A.USA\nB.China\nC.Russia\nD.India", "A.Missisipi River\nB.Yangtze River\nC.Amazon River\nD.The Nile River", @@ -287,7 +289,7 @@ void ask_hard_questions(void) { int arr[5]; int p = 0; for(int i = 0; i < 11; i++){ - if(lessFive[i] < 4){ + if(lessFive[i] < 5){ arr[p] = lessFive[i]; p++; } @@ -301,19 +303,21 @@ void ask_hard_questions(void) { "What is the capital of France?", "Who was the first president of the United States?", "Which team won the most NBA championships?", - "What is the chemical symbol for hydrogen?" + "What is the chemical symbol for hydrogen?", + "Which of the following movies won the Academy Award for Best Picture in 2020?" }; 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" }, { "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" }, { "A) He", "B) H", "C) O", "D) Ne"}, + { "A) Parasite", "B) Joker", "C) Once Upon a Time in Hollywood", "D) 1917" } }; char user_answers[NUM_QUESTIONS]; - int lifelines[NUM_QUESTIONS] = { 1, 1,1,1}; + int lifelines[NUM_QUESTIONS] = { 1, 1,1,1,1}; int randNum; - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 3; i++) { randNum = arr[i]; printf("[%d] %s\n", i + 1, questions[randNum]); for (int j = 0; j < 4; j++) { @@ -351,7 +355,7 @@ void ask_hard_questions(void) { } else { printf("\t\t--------------------Round 5-------------------\n\n"); printf(">>This is the final round. Good Luck!<<\n\n"); - for (int i = 2; i < 3; i++) { + for (int i = 3; i < 5; i++) { randNum = arr[i]; printf("[%d] %s\n", i + 1, questions[randNum]);