From f1147b0df8062d939b1c68cb1a369e33ea3951a4 Mon Sep 17 00:00:00 2001 From: fdlt3914 Date: Mon, 6 Feb 2023 15:56:01 +0000 Subject: [PATCH] print of question and possible answers-math quiz --- src/main/quizproject.c | 53 +++++++++++++++++++++++++++++++++++++++++- src/main/quizproject.h | 2 ++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 9eaca58..3f1bdec 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -181,11 +181,59 @@ void math_display_choice(){ } +void e_math_ques() { + char e_math[][140] = { + "What is the value of x if the equation 2x + 3 = 7 is solved for x?", + "Simplify the expression 4x^2 - 9x + 6.", + "What is the slope of the line y = 2x + 3?", + "What is the equation of the line that passes through the points (3,4) and (7,10)?", + "Simplify the expression 3(2x + 4) - 5", + "What is the equation of the line that is perpendicular to the line y = 2x + 3 and passes through the point (5,7)?", + "What is the value of x if the equation x^2 + 4x + 4 = 0 is solved using the quadratic formula?", + "Simplify the expression 2(x + 3) + 4(x + 2).", + "What is the equation of the circle with center (3,4) and radius 5?", + "Solve for x: x + 4 = 10.", + }; + + char e_math_possible[][140] = { + "[A]. x = 2 [b]. x = 4 [c]. x = 5 [d]. x = 1", + "[A]. 4x^2 - 4x + 6 [b]. 4x^2 - 3x + 5 [c]. 3x^2 - 3x + 6 [d]. 4x^2 - 3x + 6", + "[A]. 1 [b]. 2 [c]. 5 [d]. 4", + "[A].y = 3x - 2. [b]. y = 2x - 1 [c]. y = 3x - 3 [d]. y = 2x - 2", + "[A]. 3x - 2. [b]. 6x + 1 [c]. 6x + 7 [d]. 2x - 2", + "[A].y = 0.5x + 8.5 [b]. y = -0.5x + 8.5 [c]. y = 0.5x - 8.5 [d]. y = -0.5x - 8.5", + "[A].x = -2 or x = -2 [b]. x = -2 or x = 2 [c]. x = 2 or x = 2 [d]. x = -1 or x = -2", + "[A]. 3x + 2. [b]. 6x + 13 [c]. 6x + 14 [d]. 2x - 2", + "[A]. (x - 3)^2 + (y - 4)^2 = 2.5 [b]. (x - 2)^2 + (y - 4)^2 = 25 [c]. (x - 3)^2 + (y - 2)^2 = 25 [d]. (x - 3)^2 + (y - 4)^2 = 25", + "[A]. x = 2 [b]. x = 6 [c]. x = 5 [d]. x = 7", + + }; + + e_math_print(e_math, e_math_possible); +} + +void e_math_print(char e_ques[][140], char e_poss[][140]){ + + int i = 0; + + while(i < 10){ + printf("[%d]. %s\n", i+1, e_ques[i]); + printf(" %s\n",e_poss[i]); + printf(" Answer: "); + char user_answer; + scanf(" %c", &user_answer); + + i++; + } +} + + void math_enter_game() { int choice = 0; printf("\t\t-------------------------------------------------------\n"); - printf("\t\t Please enter 1 to start the game\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-------------------------------------------------------\n\n"); printf("Enter your choice: "); @@ -196,6 +244,9 @@ void math_enter_game() { case 1: math_display_choice(); break; + case 2: + e_math_ques(); + break; default: printf("\t\t-------------------------------------------------------\n"); printf("\t\t Sorry to see you go.\n "); diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 3aa3c25..149081f 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -42,6 +42,8 @@ void math_choose_question(int); int math_answer(int); void math_display_choice(); void math_enter_game(); +void e_math_ques(void); +void e_math_print(char [][140], char [][140]); //------Math_quiz_header_end-------