From dd0f5ca17a6c3a3330f695d7be25190a5a1982b2 Mon Sep 17 00:00:00 2001 From: fdlt3914 Date: Fri, 10 Feb 2023 01:37:56 +0000 Subject: [PATCH] goodbye_message func/ termination for brain_whiz --- src/main/quizproject.c | 31 +++++++++++++++++++++++-------- src/main/quizproject.h | 3 ++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index f9ea452..aeaf0ae 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -352,13 +352,13 @@ void math_enter_game() { //-------smart_brain_quiz_begin---------- - +/* void e_press_key_start() { char e_start_game; scanf(" %c", &e_start_game); e_start_game = toupper(e_start_game); } - +*/ void hint_anagram(int hint_num) { char hint_questions[][100] = { "d_v_l_p_e_t", @@ -381,8 +381,7 @@ void e_display_instruction() { printf("\t\t>>In the first, second Round, you answer True or false questions.<<\n"); printf("\t\t>>In the third Round, you answer questions which test your General knowledge.<< \n"); printf("\t\t-------------------------------------------------------\n\n"); - printf("\t\t>>Press any key and enter to begin the Quiz.<<\n\n"); - e_press_key_start(); + printf( "\n\nDo you still wish to continue playing ? If yes, then press 1. Else, press 0 : " ); } @@ -746,6 +745,9 @@ void e_anagram_questions() { void e_smart_brain() { e_display_instruction(); +int input1; + scanf("%d", &input1); + if(input1 == 1){ e_ask_questions(); if(score >=4 && track_r2_score ==2) { e_questions_r3(); @@ -754,6 +756,9 @@ void e_smart_brain() { e_anagram_questions(); score = 0; track_r2_score = 0; + } else{ + goodbye_message(); + } } //-------smart_brain_quiz_end------------ @@ -808,6 +813,12 @@ void math_solution(char math_solutions[][10], int init1){ } } +void goodbye_message(){ + printf("\t\t-------------------------------------------------------\n"); + printf("\t\t Sorry to see you go.\n "); + printf("\t\t-------------------------------------------------------\n\n"); +} + void math_fact_lie_print() { printf("\n\t------------------------Instructions-------------------------------\n\n"); printf("\t\tThis game presents a set of mathematical statements.\n"); @@ -816,7 +827,10 @@ void math_fact_lie_print() { printf("\t-------------------------------------------------------------------\n\n"); printf( "\t\t !! Wish you all the best !! \n\n"); printf("\t ......................................................\n" ); - + printf( "\n\nDo you still wish to continue playing ? If yes, then press 1. Else, press 0 : " ); + int input1; + scanf("%d", &input1); + if(input1 == 1){ for(int i = 0; i < 8; i++){ switch (i) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: @@ -824,6 +838,9 @@ void math_fact_lie_print() { math_fact_lie_solutions(i);break; } } + } else { + goodbye_message(); + } } @@ -894,9 +911,7 @@ void math_introduction(){ if( input1 == 1 ){ math_question2(); } else{ - printf("\t\t-------------------------------------------------------\n"); - printf("\t\t Sorry to see you go.\n "); - printf("\t\t-------------------------------------------------------\n\n"); + goodbye_message(); } } diff --git a/src/main/quizproject.h b/src/main/quizproject.h index e90f394..af9d526 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -68,7 +68,7 @@ void math_choose_game(void); //----smart_brain_header_begin----- -void e_press_key_start(void); +//void e_press_key_start(void); void e_display_instruction(void); void e_t_f_printQuestions(char [][100],char [], int []); void e_ask_questions(void); @@ -149,6 +149,7 @@ void math_fact_lie_solutions(int); void math_fact_lie_print(); void math_quiz_option(); void math_solution(char [][10], int); +void goodbye_message(); //-------brain_whiz_header_end-------------