Browse Source

created hard questions function with Round 4

main
fdlt3859 2 years ago
parent
commit
83acba955a
  1. 44
      src/main/quizproject.c
  2. 3
      src/main/quizproject.h

44
src/main/quizproject.c

@ -169,6 +169,47 @@ void ask_questions(void) {
} }
void ask_hard_questions(void) {
int k = 0;
while (k < 1) {
printf("\t\t--------------------Round 4-------------------\n\n");
printf(">>In this round you need to answer 2 questions correctly to move to Round 5<<\n\n");
char questions[NUM_QUESTIONS][256] = {
"What is the capital of France?",
"Who was the first president of the United States?"
};
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" }
};
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)
for (int i = 0; i < 2; i++) {
printf("[%d] %s\n", i + 1, questions[i]);
for (int j = 0; j < 4; j++) {
printf("%s\n", options[i][j]);
}
}
k++;
}
}
void hint(int question_num) { void hint(int question_num) {
char qC[][100] = { char qC[][100] = {
"The Tallest mountain is 8,849m." "The Tallest mountain is 8,849m."
@ -193,6 +234,9 @@ int main(){
} }
printf("\n"); printf("\n");
ask_questions(); ask_questions();
if (score > 2){
ask_hard_questions();
}
displayThankYouMessage(); displayThankYouMessage();
return 0; return 0;
} }

3
src/main/quizproject.h

@ -7,6 +7,7 @@ void displayLifelineInstructions(void);
void displayInstructions(void); void displayInstructions(void);
void displayGoodLuckMessage(void); void displayGoodLuckMessage(void);
void ask_questions(void); void ask_questions(void);
void ask_hard_questions(void);
void fifty_fifty(int); void fifty_fifty(int);
void hint(int); void hint(int);
void correct(int); void correct(int);
@ -15,4 +16,6 @@ int score = 0;
void printOutOption(char [][100], char [][100],char []); void printOutOption(char [][100], char [][100],char []);
void displayThankYouMessage(void); void displayThankYouMessage(void);
#define NUM_QUESTIONS 5
#endif #endif
Loading…
Cancel
Save