Browse Source

refactoring: added questions to hard options and

main
parent
commit
8a04c8863c
  1. 16
      src/main/quizproject.c

16
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'};
char answers[NUM_QUESTIONS] = {'B', 'A', 'A','B'};
int* randomNumber() { int* randomNumber() {
srand(time(NULL)); srand(time(NULL));
@ -115,7 +115,8 @@ void hintForHardQuestions(int question_num) {
char hints[NUM_QUESTIONS][256] = { char hints[NUM_QUESTIONS][256] = {
"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."
}; };
printf("Hint: %s\n", hints[question_num]); printf("Hint: %s\n", hints[question_num]);
} }
@ -124,7 +125,8 @@ 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) 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]; char correct_answer = answers[question_num];
int num_incorrect = 0; int num_incorrect = 0;
@ -284,8 +286,8 @@ void ask_hard_questions(void) {
int *lessFive = randomNumber(); int *lessFive = randomNumber();
int arr[5]; int arr[5];
int p = 0; 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]; arr[p] = lessFive[i];
p++; p++;
} }
@ -299,11 +301,13 @@ 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?"
}; };
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"},
}; };
char user_answers[NUM_QUESTIONS]; char user_answers[NUM_QUESTIONS];

Loading…
Cancel
Save