Browse Source

refactoring: more hard question

main
parent
commit
df0ea8ae09
  1. 24
      src/main/quizproject.c

24
src/main/quizproject.c

@ -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', 'A','B'};
char answers[NUM_QUESTIONS] = {'B', 'A', 'A','B','A'};
int* randomNumber() { int* randomNumber() {
srand(time(NULL)); 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------------------------------------------\n\n"); printf("\t\t------------------------------------------\n\n");
printf("\t\t Hello %s %s! \n\n", vorName, nachName); 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");
printf("\t\t------------------------------------------\n\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"); 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.", "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.", "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."
"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]); 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) 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) 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]; char correct_answer = answers[question_num];
int num_incorrect = 0; int num_incorrect = 0;
@ -241,7 +243,7 @@ void ask_questions(void) {
"What is the capital of Thailand?\n", "What is the capital of Thailand?\n",
"In which country was Frida Kahlo born?\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.Mount Everest\nB.Uludag\nC.K2\nD.Makalu",
"A.USA\nB.China\nC.Russia\nD.India", "A.USA\nB.China\nC.Russia\nD.India",
"A.Missisipi River\nB.Yangtze River\nC.Amazon River\nD.The Nile River", "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 arr[5];
int p = 0; int p = 0;
for(int i = 0; i < 11; i++){ for(int i = 0; i < 11; i++){
if(lessFive[i] < 4){
if(lessFive[i] < 5){
arr[p] = lessFive[i]; arr[p] = lessFive[i];
p++; p++;
} }
@ -301,19 +303,21 @@ void ask_hard_questions(void) {
"What is the capital of France?", "What is the capital of France?",
"Who was the first president of the United States?", "Who was the first president of the United States?",
"Which team won the most NBA championships?", "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] = { 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) 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 user_answers[NUM_QUESTIONS]; char user_answers[NUM_QUESTIONS];
int lifelines[NUM_QUESTIONS] = { 1, 1,1,1};
int lifelines[NUM_QUESTIONS] = { 1, 1,1,1,1};
int randNum; int randNum;
for (int i = 0; i < 2; i++) {
for (int i = 0; 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++) {
@ -351,7 +355,7 @@ 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 = 2; i < 3; i++) {
for (int i = 3; i < 5; i++) {
randNum = arr[i]; randNum = arr[i];
printf("[%d] %s\n", i + 1, questions[randNum]); printf("[%d] %s\n", i + 1, questions[randNum]);

Loading…
Cancel
Save