From 9d15564150941ed0787802e405f5a96e51c9793c Mon Sep 17 00:00:00 2001 From: fdlt3885 Date: Wed, 8 Feb 2023 23:16:02 +0000 Subject: [PATCH] added History Mini-Game --- src/main/quizproject.c | 51 +++++++++++++++++++++++++++++++++++++++++- src/main/quizproject.h | 3 +++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 638b736..55a8b2f 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -2496,6 +2496,50 @@ void b_gamble() } +//History Game + +void b_historyevents() { + int year, score = 0; + + printf("Welcome to the history quiz!\n"); + printf("Enter the year of the following historical events:\n"); + + printf("\nEvent 1: The American Revolution\n"); + printf("Year: "); + scanf("%d", &year); + if (year == 1776) { + printf("You got it right!\n"); + score++; + } else { + printf("Nope, the correct year is 1776.\n"); + } + + printf("\nEvent 2: The fall of the Berlin Wall\n"); + printf("Year: "); + scanf("%d", &year); + if (year == 1989) { + printf("You got it right!\n"); + score++; + } else { + printf("Nope, the correct year is 1989.\n"); + } + + printf("\nEvent 3: The end of World War II\n"); + printf("Year: "); + scanf("%d", &year); + if (year == 1945) { + printf("You got it right!\n"); + score++; + } else { + printf("Nope, the correct year is 1945.\n"); + } + + printf("\nYou scored %d/3.\n", score); + printf("Thanks for playing!\n"); +} + + + void v_play_rockpapersciss(){ int player_choice, computer_choice, player_score = 0, computer_score = 0; srand(time(NULL)); @@ -2974,7 +3018,8 @@ int main(int argc, char *argv[]) { printf("16. Breaking Bad Quiz!\n"); printf("17. Mini-Game: Crossword Puzzle!\n"); printf("18. Gambling Game!\n"); - printf("19. Exit\n"); + printf("19. Mini-Game: History Quiz!\n"); + printf("20. Exit\n"); printf("Enter your choice: "); scanf("%d", &choice); v_progress_bar(argc,argv); @@ -3053,6 +3098,10 @@ int main(int argc, char *argv[]) { jump_to_menu = 1; break; case 19: + b_historyevents(); + jump_to_menu = 1; + break; + case 20: printf("\nThank you for trying our C code!\n"); break; default: diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 65cd017..07ea7cb 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -122,6 +122,9 @@ void b_crossword(); //Gambling Game Headers void b_gamble(); +//History Game Headers +void b_historyevents(); + #define NUM_QUESTIONS 5