|
@ -4,7 +4,7 @@ |
|
|
#include <ctype.h> |
|
|
#include <ctype.h> |
|
|
#include <string.h> |
|
|
#include <string.h> |
|
|
#include "quizproject.h" |
|
|
#include "quizproject.h" |
|
|
|
|
|
|
|
|
|
|
|
char answers[NUM_QUESTIONS] = {'B', 'A'}; |
|
|
|
|
|
|
|
|
int* randomNumber() { |
|
|
int* randomNumber() { |
|
|
srand(time(NULL)); |
|
|
srand(time(NULL)); |
|
@ -109,13 +109,20 @@ void fifty_fifty(int question_num) { |
|
|
printf("%s\n",qC[question_num]); |
|
|
printf("%s\n",qC[question_num]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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." |
|
|
|
|
|
}; |
|
|
|
|
|
printf("Hint: %s\n", hints[question_num]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void fifty_fifty1(int question_num) { |
|
|
void fifty_fifty1(int question_num) { |
|
|
char options[NUM_QUESTIONS][4][256] = { |
|
|
char options[NUM_QUESTIONS][4][256] = { |
|
|
{ "A) Berlin", "B) Paris", "C) London", "D) Rome" }, |
|
|
{ "A) Berlin", "B) Paris", "C) London", "D) Rome" }, |
|
|
{ "A) George Washington", "B) John Adams", "C) Thomas Jefferson", "D) James Madison" }, |
|
|
{ "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" } |
|
|
|
|
|
|
|
|
{ "A) Los Angeles Lakers", "B) Chicago Bulls", "C) Golden State Warriors", "D) Boston Celtics" } |
|
|
}; |
|
|
}; |
|
|
char correct_answer = answers[question_num]; |
|
|
char correct_answer = answers[question_num]; |
|
|
int num_incorrect = 0; |
|
|
int num_incorrect = 0; |
|
@ -282,16 +289,18 @@ void ask_hard_questions(void) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char questions[NUM_QUESTIONS][256] = { |
|
|
char questions[NUM_QUESTIONS][256] = { |
|
|
"Which author is famed for her detective novels about Hercule Poirot and Miss Marple?", |
|
|
|
|
|
"Atticus Finch is one of the main characters in which novel from 1960?" |
|
|
|
|
|
|
|
|
"What is the capital of France?", |
|
|
|
|
|
"Who was the first president of the United States?", |
|
|
|
|
|
"Which team won the most NBA championships?", |
|
|
}; |
|
|
}; |
|
|
char options[NUM_QUESTIONS][4][256] = { |
|
|
char options[NUM_QUESTIONS][4][256] = { |
|
|
{ "A) Arthur Conan Doyle", "B) Agatha Christie", "C) Charles Dickens", "D) Stephen King" }, |
|
|
|
|
|
{ "A) To Kill a Mockingbird", "B) Pride and Prejudice", "C) The Great Gatsby", "D) Jane Eyre" } |
|
|
|
|
|
|
|
|
{ "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" } |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
char user_answers[NUM_QUESTIONS]; |
|
|
char user_answers[NUM_QUESTIONS]; |
|
|
int lifelines[NUM_QUESTIONS] = { 1, 1}; |
|
|
|
|
|
|
|
|
int lifelines[NUM_QUESTIONS] = { 1, 1,1,1}; |
|
|
int randNum; |
|
|
int randNum; |
|
|
for (int i = 0; i < 2; i++) { |
|
|
for (int i = 0; i < 2; i++) { |
|
|
randNum = arr[i]; |
|
|
randNum = arr[i]; |
|
@ -299,7 +308,7 @@ void ask_hard_questions(void) { |
|
|
for (int j = 0; j < 4; j++) { |
|
|
for (int j = 0; j < 4; j++) { |
|
|
printf("%s\n", options[randNum][j]); |
|
|
printf("%s\n", options[randNum][j]); |
|
|
} |
|
|
} |
|
|
printf("Enter your answer (A, B, C, or D): "); |
|
|
|
|
|
|
|
|
printf("Enter your answer (A, B, C, or D) or use a lifeline (F for 50/50, H for hint): "); |
|
|
char response; |
|
|
char response; |
|
|
scanf(" %c", &response); |
|
|
scanf(" %c", &response); |
|
|
response = toupper(response); |
|
|
response = toupper(response); |
|
@ -309,8 +318,13 @@ void ask_hard_questions(void) { |
|
|
scanf(" %c", &user_answers[randNum]); |
|
|
scanf(" %c", &user_answers[randNum]); |
|
|
user_answers[randNum] = toupper(user_answers[randNum]); |
|
|
user_answers[randNum] = toupper(user_answers[randNum]); |
|
|
lifelines[i] = 0; |
|
|
lifelines[i] = 0; |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
}else if (response == 'H' && lifelines[i] == 1) { |
|
|
|
|
|
hintForHardQuestions(randNum); |
|
|
|
|
|
printf("Enter your answer (A, B, C, or D): "); |
|
|
|
|
|
scanf(" %c", &user_answers[randNum]); |
|
|
|
|
|
user_answers[randNum] = toupper(user_answers[randNum]); |
|
|
|
|
|
lifelines[i] = 0; |
|
|
|
|
|
}else { |
|
|
user_answers[randNum] = response; |
|
|
user_answers[randNum] = response; |
|
|
} |
|
|
} |
|
|
if (user_answers[randNum] == answers[randNum]) { |
|
|
if (user_answers[randNum] == answers[randNum]) { |
|
@ -326,14 +340,14 @@ void ask_hard_questions(void) { |
|
|
} else { |
|
|
} else { |
|
|
printf("\t\t--------------------Round 5-------------------\n\n"); |
|
|
printf("\t\t--------------------Round 5-------------------\n\n"); |
|
|
printf(">>This is the final round. Good Luck!<<\n\n"); |
|
|
printf(">>This is the final round. Good Luck!<<\n\n"); |
|
|
for (int i = 0; i < 2; i++) { |
|
|
|
|
|
|
|
|
for (int i = 2; i < 3; i++) { |
|
|
|
|
|
|
|
|
randNum = arr[i]; |
|
|
randNum = arr[i]; |
|
|
printf("[%d] %s\n", i + 1, questions[randNum]); |
|
|
printf("[%d] %s\n", i + 1, questions[randNum]); |
|
|
for (int j = 0; j < 4; j++) { |
|
|
for (int j = 0; j < 4; j++) { |
|
|
printf("%s\n", options[randNum][j]); |
|
|
printf("%s\n", options[randNum][j]); |
|
|
} |
|
|
} |
|
|
printf("Enter your answer (A, B, C, or D): "); |
|
|
|
|
|
|
|
|
printf("Enter your answer (A, B, C, or D) or use a lifeline (F for 50/50, H for hint): "); |
|
|
char response; |
|
|
char response; |
|
|
scanf(" %c", &response); |
|
|
scanf(" %c", &response); |
|
|
response = toupper(response); |
|
|
response = toupper(response); |
|
@ -343,8 +357,13 @@ void ask_hard_questions(void) { |
|
|
scanf(" %c", &user_answers[randNum]); |
|
|
scanf(" %c", &user_answers[randNum]); |
|
|
user_answers[randNum] = toupper(user_answers[randNum]); |
|
|
user_answers[randNum] = toupper(user_answers[randNum]); |
|
|
lifelines[i] = 0; |
|
|
lifelines[i] = 0; |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
}else if (response == 'H' && lifelines[i] == 1) { |
|
|
|
|
|
hintForHardQuestions(randNum); |
|
|
|
|
|
printf("Enter your answer (A, B, C, or D): "); |
|
|
|
|
|
scanf(" %c", &user_answers[randNum]); |
|
|
|
|
|
user_answers[randNum] = toupper(user_answers[randNum]); |
|
|
|
|
|
lifelines[i] = 0; |
|
|
|
|
|
}else { |
|
|
user_answers[randNum] = response; |
|
|
user_answers[randNum] = response; |
|
|
} |
|
|
} |
|
|
// check each answer |
|
|
// check each answer |
|
|