From 417e3cc1da03533ba3722e319160a5e16f6b5018 Mon Sep 17 00:00:00 2001 From: fdlt3914 Date: Thu, 9 Feb 2023 21:26:59 +0000 Subject: [PATCH] brain whiz questions loop --- src/main/quizproject.c | 29 +++++++++++++++++++++++++++-- src/main/quizproject.h | 6 ++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 4332156..3065120 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -756,6 +756,26 @@ void e_smart_brain() { track_r2_score = 0; } //-------smart_brain_quiz_end------------ + +//-------brain_whiz_quiz_begin------------ + +void for_loop_print_question() { + for (int i = 1; i < 4; i++){ + char user_answer; + printf("[%d]. Simplify 5x + 7 - 3x.\n",i); + printf("[A]. 2x + 7 [B]. 3x + 7 [C]. x + 6\n"); + scanf(" %c", &user_answer); + if (user_answer == 'A') { + printf("Right!\n"); + } else { + printf("Wrong!\n"); + } + } +} + +//-------brain_whiz_quiz_end-------------- + + void million_instructions(){ printf("-------------------INSTRUCTIONS--------------------\n"); printf("Possible answers are A,B,C & D\n"); @@ -3236,7 +3256,7 @@ int main(int argc, char *argv[]) { int jump_to_menu = 0; - while (choice != 21 || jump_to_menu) { + while (choice != 22 || jump_to_menu) { printf("Welcome to the Game Menu!\n"); printf("1. QuizGame\n"); printf("2. Fact or Lie?\n"); @@ -3258,7 +3278,8 @@ int main(int argc, char *argv[]) { printf("18. Gambling Game!\n"); printf("19. Mini-Game: History Quiz!\n"); printf("20. All About Space and the Universe!\n"); - printf("21. Exit\n"); + printf("21. Brain whiz\n"); + printf("22. Exit\n"); printf("Enter your choice: "); scanf("%d", &choice); v_progress_bar(argc,argv); @@ -3345,6 +3366,10 @@ int main(int argc, char *argv[]) { jump_to_menu = 1; break; case 21: + for_loop_print_question(); + jump_to_menu = 1; + break; + case 22: printf("\nThank you for trying our C code!\n"); break; default: diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 25d15ae..76fa0a0 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -138,6 +138,12 @@ void b_gamble(); //History Game Headers void b_historyevents(); +//-------brain_whiz_header_begin------------ + +void for_loop_print_question(); + +//-------brain_whiz_header_end------------- + #define NUM_QUESTIONS 5