|
@ -189,24 +189,30 @@ void ask_hard_questions(void) { |
|
|
}; |
|
|
}; |
|
|
char answers[NUM_QUESTIONS] = { 'B', 'A'}; // correct answers (A, B, C, or D) |
|
|
char answers[NUM_QUESTIONS] = { 'B', 'A'}; // correct answers (A, B, C, or D) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char user_answers[NUM_QUESTIONS]; // to store user answers (A, B, C, or D) |
|
|
char user_answers[NUM_QUESTIONS]; // to store user answers (A, B, C, or D) |
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++) { |
|
|
for (int i = 0; i < 2; i++) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("[%d] %s\n", i + 1, questions[i]); |
|
|
printf("[%d] %s\n", i + 1, questions[i]); |
|
|
for (int j = 0; j < 4; j++) { |
|
|
for (int j = 0; j < 4; j++) { |
|
|
printf("%s\n", options[i][j]); |
|
|
printf("%s\n", options[i][j]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
printf("Enter your answer (A, B, C, or D): "); |
|
|
|
|
|
char response; |
|
|
|
|
|
scanf(" %c", &response); |
|
|
|
|
|
response = toupper(response); |
|
|
|
|
|
user_answers[i] = response; |
|
|
|
|
|
// check each answer |
|
|
|
|
|
if (user_answers[i] == answers[i]) { |
|
|
|
|
|
score++; |
|
|
|
|
|
correct(score); |
|
|
|
|
|
} else { |
|
|
|
|
|
wrong(score); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
k++; |
|
|
k++; |
|
|
} |
|
|
} |
|
|
|
|
|
printf("\nYour final score: %d\n", score); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -217,7 +223,7 @@ void hint(int question_num) { |
|
|
printf("%s\n",qC[question_num]); |
|
|
printf("%s\n",qC[question_num]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void displayThankYouMessage(void) { // 4 & 5 |
|
|
|
|
|
|
|
|
void displayThankYouMessage(void) { |
|
|
printf("*******************************\n"); |
|
|
printf("*******************************\n"); |
|
|
printf("Thank you for playing QuizGame!\n"); |
|
|
printf("Thank you for playing QuizGame!\n"); |
|
|
printf("*******************************\n\n"); |
|
|
printf("*******************************\n\n"); |
|
|