From bebfc870ca1b65c63489383d00299c85a1577b5c Mon Sep 17 00:00:00 2001 From: fdlt3859 Date: Mon, 6 Feb 2023 23:48:35 +0000 Subject: [PATCH] Added horoscope checker --- src/main/quizproject.c | 48 +++++++++++++++++++++++++++++++++++++++++- src/main/quizproject.h | 3 ++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index bcc5c57..d91cc20 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -2206,6 +2206,47 @@ void v_play_rockpapersciss(){ printf("******************************************\n\n"); } +void v_horoscope(int day, int month){ + + if ((month == 3 && day >= 21) || (month == 4 && day <= 19)) { + printf("Your horoscope is Aries.\n"); + } else if ((month == 4 && day >= 20) || (month == 5 && day <= 20)) { + printf("Your horoscope is Taurus.\n"); + } else if ((month == 5 && day >= 21) || (month == 6 && day <= 20)) { + printf("Your horoscope is Gemini.\n"); + } else if ((month == 6 && day >= 21) || (month == 7 && day <= 22)) { + printf("Your horoscope is Cancer.\n"); + } else if ((month == 7 && day >= 23) || (month == 8 && day <= 22)) { + printf("Your horoscope is Leo.\n"); + } else if ((month == 8 && day >= 23) || (month == 9 && day <= 22)) { + printf("Your horoscope is Virgo.\n"); + } else if ((month == 9 && day >= 23) || (month == 10 && day <= 22)) { + printf("Your horoscope is Libra.\n"); + } else if ((month == 10 && day >= 23) || (month == 11 && day <= 21)) { + printf("Your horoscope is Scorpio.\n"); + } else if ((month == 11 && day >= 22) || (month == 12 && day <= 21)) { + printf("Your horoscope is Sagittarius.\n"); + } else if ((month == 12 && day >= 22) || (month == 1 && day <= 19)) { + printf("Your horoscope is Capricorn.\n"); + } else if ((month == 1 && day >= 20) || (month == 2 && day <= 18)) { + printf("Your horoscope is Aquarius.\n"); + } else if ((month == 2 && day >= 19) || (month == 3 && day <= 20)) { + printf("Your horoscope is Pisces.\n"); + } else { + printf("Invalid birth date.\n"); + } +} + +void v_play_horoscope(void) { + int day, month; + + printf("Enter your birth day: "); + scanf("%d", &day); + printf("Enter your birth month (in number): "); + scanf("%d", &month); + + v_horoscope(day, month); +} void feedbackForm(void){ int rating; @@ -2301,7 +2342,8 @@ int main(int argc, char *argv[]) { printf("7. Epic Game\n"); printf("8. Rock,Paper,Scissors!\n"); printf("9. Math Quiz\n"); - printf("10. Exit\n"); + printf("10. Check your Horoscope!\n"); + printf("11. Exit\n"); printf("Enter your choice: "); scanf("%d", &choice); v_progress_bar(argc,argv); @@ -2344,6 +2386,10 @@ int main(int argc, char *argv[]) { jump_to_menu = 1; break; case 10: + v_play_horoscope(); + jump_to_menu = 1; + break; + case 11: printf("\nThank you for trying our C code!\n"); break; default: diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 86351e0..4bfacc9 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -31,7 +31,8 @@ void v_guessTheWord(char word[], char guessed[]); void progress_bar(int percentage); void v_progress_bar(int argc, char *argv[]); void v_play_rockpapersciss(void); - +void v_horoscope(int day, int month); +void v_play_horoscope(void); void million_instructions(); void million_exit(int million_a);