From 8a04c8863ca8a70af50f54cf1de8c3b2e3500a56 Mon Sep 17 00:00:00 2001 From: fdlt3914 Date: Fri, 27 Jan 2023 20:49:28 +0000 Subject: [PATCH] refactoring: added questions to hard options and --- src/main/quizproject.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index b1bb84f..aad3748 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'}; +char answers[NUM_QUESTIONS] = {'B', 'A', 'A','B'}; int* randomNumber() { srand(time(NULL)); @@ -115,7 +115,8 @@ void hintForHardQuestions(int question_num) { char hints[NUM_QUESTIONS][256] = { "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." + "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." }; printf("Hint: %s\n", hints[question_num]); } @@ -124,7 +125,8 @@ void fifty_fifty1(int question_num) { 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) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" }, + { "A) He", "B) H", "C) O", "D) Ne" } }; char correct_answer = answers[question_num]; int num_incorrect = 0; @@ -284,8 +286,8 @@ void ask_hard_questions(void) { int *lessFive = randomNumber(); int arr[5]; int p = 0; - for(int i = 0; i < 8; i++){ - if(lessFive[i] < 2){ + for(int i = 0; i < 11; i++){ + if(lessFive[i] < 4){ arr[p] = lessFive[i]; p++; } @@ -299,11 +301,13 @@ 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?" }; 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) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" }, + { "A) He", "B) H", "C) O", "D) Ne"}, }; char user_answers[NUM_QUESTIONS];