From 1e7c183005be64d0ce34c60dcb3f8df14b098a70 Mon Sep 17 00:00:00 2001 From: fdlt3885 Date: Wed, 8 Feb 2023 20:30:04 +0000 Subject: [PATCH] Added Germany Quiz game and header --- src/main/quizproject.c | 75 +++++++++++++++++++++++++++++++++++++++++- src/main/quizproject.h | 4 +++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 618cae7..13591e3 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -2295,6 +2295,74 @@ void b_guessbirthyear() } +//Germany Quiz + +void b_germanyquiz() +{ + int score = 0; + + printf("Welcome to Germany Quiz.\n\n"); + printf("1. Germany is located in Europe.\n"); + printf("True or False?\n"); + char answer1[5]; + scanf("%s", answer1); + if (strcmp(answer1, "True") == 0) { + printf("Correct!\n"); + score++; + } else { + printf("Incorrect. The answer is True.\n"); + } + + printf("2. Berlin is the capital city of Germany.\n"); + printf("True or False?\n"); + char answer2[5]; + scanf("%s", answer2); + if (strcmp(answer2, "True") == 0) { + printf("Correct!\n"); + score++; + } else { + printf("Incorrect. The answer is True.\n"); + } + + printf("3. The currency used in Germany is the Euro.\n"); + printf("True or False?\n"); + char answer3[5]; + scanf("%s", answer3); + if (strcmp(answer3, "True") == 0) { + printf("Correct!\n"); + score++; + } else { + printf("Incorrect. The answer is True.\n"); + } + + printf("4. The population of Germany is over 100 million.\n"); + printf("True or False?\n"); + char answer4[5]; + scanf("%s", answer4); + if (strcmp(answer4, "False") == 0) { + printf("Correct!\n"); + score++; + } else { + printf("Incorrect. The answer is False.\n"); + } + + printf("5. The official language of Germany is French.\n"); + printf("True or False?\n"); + char answer5[5]; + scanf("%s", answer5); + if (strcmp(answer5, "False") == 0) { + printf("Correct!\n"); + score++; + } else { + printf("Incorrect. The answer is False.\n"); + } + + printf("You scored %d out of 5.\n", score); + printf("Thank You for Playing Germany Quiz.\n"); + +} + + void v_play_rockpapersciss(){ int player_choice, computer_choice, player_score = 0, computer_score = 0; @@ -2770,7 +2838,8 @@ int main(int argc, char *argv[]) { printf("12. Mini-Game: Guess the animal!\n"); printf("13. Basketball Quiz!\n"); printf("14. Guess Barack Obama's birth Year!\n"); - printf("15. Exit\n"); + printf("15. Germany Quiz!\n"); + printf("16. Exit\n"); printf("Enter your choice: "); scanf("%d", &choice); v_progress_bar(argc,argv); @@ -2833,6 +2902,10 @@ int main(int argc, char *argv[]) { jump_to_menu = 1; break; case 15: + b_germanyquiz(); + jump_to_menu = 1; + break; + case 16: printf("\nThank you for trying our C code!\n"); break; default: diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 0da448e..b9be8da 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -110,6 +110,10 @@ void b_basketballQuiz(); //Guess Birth Year Headers void b_guessbirthyear(); +//Germany Quiz Headers +void b_germanyquiz(); + + #define NUM_QUESTIONS 5 #define NUM_ROUNDS 15