From 183ef21a38ec5a4a7b00e12a69269cb27b5fd853 Mon Sep 17 00:00:00 2001 From: fdlt3885 Date: Fri, 10 Feb 2023 11:58:11 +0000 Subject: [PATCH] Added Personality Quiz and headers --- src/main/quizproject.c | 55 ++++++++++++++++++++++++++++++++++++++++-- src/main/quizproject.h | 7 ++++++ 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 44d5a8f..1f91b52 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -2739,7 +2739,53 @@ void b_historyevents() { printf("Thanks for playing!\n"); } +void b_personality() { + char name[100]; + printf("What's your name? "); + scanf("%s", name); + + printf("On a scale of 1 to 10, how introverted are you? "); + scanf("%d", &introverted); + + printf("On a scale of 1 to 10, how energetic are you? "); + scanf("%d", &energetic); + + printf("On a scale of 1 to 10, how optimistic are you? "); + scanf("%d", &optimistic); + + printf("On a scale of 1 to 10, how empathetic are you? "); + scanf("%d", &empathetic); + + printf("\nSummary for %s:\n\n", name); + + printf("Based on your answers, %s is a person who is\n ", name); + if (introverted >= 7) { + printf("introverted and tends to prefer more solitary activities.\n "); + } else { + printf("extroverted and tends to enjoy being in social situations.\n "); + } + + if (energetic >= 7) { + printf("They are full of energy and always on the go.\n "); + } else { + printf("They are relaxed and tend to take a more laid-back approach to life.\n "); + } + + if (optimistic >= 7) { + printf("They have an optimistic outlook on life and are generally hopeful and positive.\n "); + } else { + printf("They have a pessimistic outlook on life and tend to focus on the negative.\n "); + } + if (empathetic >= 7) { + printf("%s is a very empathetic person who is able to understand and connect with others.\n ", name); + } else { + printf("%s is not as empathetic and may have trouble connecting with others emotionally.\n ", name); + } + + printf("\n\nThis is just a general summary based on the answers provided.\nEveryone is unique and complex, and these answers only provide a limited \nview into %s's personality.", name); + +} void v_play_rockpapersciss(){ int player_choice, computer_choice, player_score = 0, computer_score = 0; @@ -3336,7 +3382,7 @@ int main(int argc, char *argv[]) { int jump_to_menu = 0; - while (choice != 22 || jump_to_menu) { + while (choice != 23 || jump_to_menu) { printf("Welcome to the Game Menu!\n"); printf("1. QuizGame\n"); printf("2. Fact or Lie?\n"); @@ -3359,7 +3405,8 @@ int main(int argc, char *argv[]) { printf("19. Mini-Game: History Quiz!\n"); printf("20. All About Space and the Universe!\n"); printf("21. Brain whiz\n"); - printf("22. Exit\n"); + printf("22. Personality Quiz!\n"); + printf("23. Exit\n"); printf("Enter your choice: "); scanf("%d", &choice); v_progress_bar(argc,argv); @@ -3450,6 +3497,10 @@ int main(int argc, char *argv[]) { jump_to_menu = 1; break; case 22: + b_personality(); + jump_to_menu = 1; + break; + case 23: printf("\nThank you for trying our C code!\n"); break; default: diff --git a/src/main/quizproject.h b/src/main/quizproject.h index c90cc7c..c69bf03 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -138,6 +138,13 @@ void b_gamble(); //History Game Headers void b_historyevents(); +//Personality Quiz Headers +void b_personality(); +int introverted; +int energetic; +int optimistic; +int empathetic; + //-------brain_whiz_header_begin------------ void for_loop_print_question(char [][140], char [][140], char []);