Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Complete the C program which should first ask the user to enter their birth year. It should then print out what (approximate) Chinese zodiac animal
Complete the C program which should first ask the user to enter their birth year. It should then print out what (approximate) Chinese zodiac animal that year corresponds to. (For simplicity, we'll assume that the each calendar year corresponds exactly to a zodiac animal). You can assume the year entered will be no earlier than 1900 , (we will not test any years before 1900 ). The starter code contains an which defines the different Chinese zodiac animals. In your program, you should aim to: 1. Scan in the year (as an integer) 2. Calculate which zodiac animal that year corresponds to, and convert it into an enum zadiac animal variable 3. Use that enum to decide which message to print out. NOIE The Chinese Zodiac There are twelve Chinese zodiac animals: Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey, Rooster, Dog and Pig. Each year approxiamately corresponds to a zodiac animal. For example: - The year 1900 corresponds to the Rat. - The year 1901 corresponds to the Ox. - The year 1902 corresponds to the Tiger. - ... - The year 1911 corresponds to the Pig. - The year 1912 corresponds to the Rat. Click here to learn more about the Chinese zodiac. Hint: You might find that the operator is useful for this exercise. You might also find the provided rrdefine Mny_teat 2900 useful
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started