From 5cebf050b7815fa39a12be61de6ed5dee2066216 Mon Sep 17 00:00:00 2001 From: fdlt3859 Date: Mon, 30 Jan 2023 15:57:07 +0000 Subject: [PATCH] User can now jump back to menu after playing --- src/main/quizproject.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 9b9652d..c73f24d 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -559,6 +559,9 @@ int main() { printf("\n\nPlease choose one of the number options from below\n\n"); } + int jump_to_menu = 0; + + while (choice != 4 || jump_to_menu) { printf("Welcome to the Game Menu!\n"); printf("1. QuizGame\n"); printf("2. Fact or Lie?\n"); @@ -570,22 +573,34 @@ int main() { switch(choice) { case 1: play_quizgame(); + jump_to_menu = 1; break; case 2: play_factorlie(); + jump_to_menu = 1; break; case 3: play_milliongame(); + jump_to_menu = 1; break; case 4: - printf("Exiting the Game Menu...\n"); + printf("\nThank you for trying our C code!\n"); break; default: printf("Invalid choice!\n"); } + if (jump_to_menu) { + jump_to_menu = 0; + printf("\nType any key and press enter to jump back to the menu.\n"); + char jump_key; + scanf(" %c", &jump_key); + jump_key = toupper(jump_key); + } + } feedbackForm(); displayCredits(); return 0; } +