From ddc7d366ac4b27113603d1408ac1c3f73a0729ab Mon Sep 17 00:00:00 2001 From: fdlt3914 Date: Tue, 31 Jan 2023 02:31:35 +0000 Subject: [PATCH] round 1 and 2 print out --- src/main/quizproject.c | 54 ++++++++++++++++++++++++++++++++++++++++++ src/main/quizproject.h | 2 ++ 2 files changed, 56 insertions(+) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 9d2e0cc..495aaa8 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -3,6 +3,7 @@ #include #include #include +#include #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------------ diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 616b237..86e854a 100644 --- a/src/main/quizproject.h +++ b/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-------