From 0d418081f3fb3e7604273d84c8d018c673b2d8a4 Mon Sep 17 00:00:00 2001 From: fdlt3914 Date: Mon, 6 Feb 2023 16:21:10 +0000 Subject: [PATCH] math-qiuz instruction and option choice. --- src/main/quizproject.c | 55 ++++++++++++++++++++++++++++++++++++++---- src/main/quizproject.h | 2 ++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 3f1bdec..e1a4793 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -30,6 +30,51 @@ int* randomNumber() { //------------Math_quiz_begin------------ +void math_help(){ + printf( "\n\n Instructions that are supposed to be followed\n" ); + printf("......................................................\n\n" ); + printf( "As soon as you answer a question, you will be directed to the next question without any pause. " ); + printf( "\n\n !! Wish you all the best !! \n\n " ); + printf("......................................................\n" ); + printf( "\n Do you still wish to continue playing ? If yes, then press 1. Else, press 0 : " ); + int input1; + scanf("%d", &input1); + + if( input1 == 1 ){ + math_enter_game(); + } else{ + printf("\t\t-------------------------------------------------------\n"); + printf("\t\t Sorry to see you go.\n "); + printf("\t\t-------------------------------------------------------\n\n"); + } +} + + +void math_choose_game() { + printf("\t\t-------------------------------------------------------\n"); + printf("\t\t There are Two type of Math quiz\n"); + printf("\t\t A]. Easy-Math\n"); + printf("\t\t B]. Hard-Math\n"); + printf("\t\t-------------------------------------------------------\n\n"); + printf("\t\t Type any key and press enter to exit\n"); + printf("\t\t Choose either A or B to begin the quiz you want\n"); + + char choose; + scanf(" %c", &choose); + choose = toupper(choose); + if (choose == 'A'){ + math_display_choice(); + } else if(choose == 'B'){ + e_math_ques(); + } else { + printf("\t\t-------------------------------------------------------\n"); + printf("\t\t Sorry to see you go.\n "); + printf("\t\t-------------------------------------------------------\n\n"); + } + +} + + void math_choose_question(int num1) { char choose [][100] = { "what is 1 + 1\n", @@ -232,9 +277,9 @@ void e_math_print(char e_ques[][140], char e_poss[][140]){ void math_enter_game() { int choice = 0; printf("\t\t-------------------------------------------------------\n"); - printf("\t\t Please enter 1 to start the game 1\n "); - printf("\t\t Please enter 2 to start the game 2\n "); - printf("\t\t Please enter 0 to exit \n"); + printf("\t\t Please press 1 to enter Quiz-game \n "); + printf("\t\t Please press 2 to see Instruction\n "); + printf("\t\t Please press 0 to Exit \n"); printf("\t\t-------------------------------------------------------\n\n"); printf("Enter your choice: "); @@ -242,10 +287,10 @@ void math_enter_game() { switch (choice){ // in order to start the game case 1: - math_display_choice(); + math_choose_game(); break; case 2: - e_math_ques(); + math_help(); break; default: printf("\t\t-------------------------------------------------------\n"); diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 149081f..df462ab 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -44,6 +44,8 @@ void math_display_choice(); void math_enter_game(); void e_math_ques(void); void e_math_print(char [][140], char [][140]); +void math_help(void); +void math_choose_game(void); //------Math_quiz_header_end-------