Browse Source

round 1 and 2 print out

main
parent
commit
ddc7d366ac
  1. 54
      src/main/quizproject.c
  2. 2
      src/main/quizproject.h

54
src/main/quizproject.c

@ -3,6 +3,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdbool.h>
#include "quizproject.h"
char answers[NUM_QUESTIONS] = {'B', 'A', 'A','B','A'};
@ -38,12 +39,65 @@ void e_display_instruction() {
printf("\t\t-------------------------------------------------------\n");
printf("\t\t To start this Quiz, here are the instructions\n");
printf("\t\t------------------------------------------------------\n\n");
printf("\t\t>>In the first, second Round, you answer True or false questions.<<\n\n");
printf("\t\t-------------------------------------------------------\n\n");
printf("\t\t>>Press any key and enter to begin the Quiz.<<\n\n");
e_press_key_start();
}
void e_t_f_printQuestions(char askquestion[][100],char answers[]) {
int i;
char user_answer;
printf("\t\t---------------------------Round1-----------------------------\n");
printf("\t\t >>In this round you will be presented with 3 questions.<<\n");
printf("\t\t--------------------------------------------------------------\n\n");
for(i = 0; i < 3; i++) {
printf("[%d]. %s", i + 1, askquestion[i]);
scanf(" %c", &user_answer);
user_answer = toupper(user_answer);
printf(" The answer is: %d\n\n", answers[i]);
}
printf("\t\t---------------------------Round2-----------------------------\n");
printf("\t\t >>In this round you will be presented with 2 questions.<<\n");
printf("\t\t--------------------------------------------------------------\n\n");
for(i = 3; i < 5; i++) {
printf("[%d]. %s", i + 1, askquestion[i]);
scanf(" %c", &user_answer);
user_answer = toupper(user_answer);
printf(" The answer is: %d\n\n", answers[i]);
}
}
void e_ask_questions(void) {
char e_t_f_question[][100] = {
"Mount Everest is the tallest mountain in the world:\n [T/F]: ",
"USA has the largest population in the world:\n [T/F]: ",
"Russia is the largest country by land size:\n [T/F]: ",
"Donald trump is the current president of USA:\n [T/F]: ",
"Cheese are made from plants:\n [T/F]: ",
"Tomato ist a fruit:\n [T/F]: ",
"Men have 2 X chromosomes:\n [T/F]: "
};
char e_t_f_solution[100] = {
true,
false,
true,
false,
false,
true,
false
};
e_t_f_printQuestions(e_t_f_question, e_t_f_solution);
}
void e_smart_brain() {
e_display_instruction();
e_ask_questions();
}
//-------smart_brain_quiz_end------------

2
src/main/quizproject.h

@ -34,6 +34,8 @@ void v_guessTheWord(char word[], char guessed[]);
void e_press_key_start(void);
void e_display_instruction(void);
void e_t_f_printQuestions(char [][100],char []);
void e_ask_questions(void);
void e_smart_brain(void);
//----smart_brain_header_end-------

Loading…
Cancel
Save