Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ Question 5(10pt): Days in a month Write a program that asks the user to enter a year and month(1-12). Then, the program should display
c++
Question 5(10pt): Days in a month Write a program that asks the user to enter a year and month(1-12). Then, the program should display the number of days in that month. If the entered month is not between 1 and 12, then print "Invalid month". Don't forget about leap years! What is a leap year? In general, years divisible by 4 are leap years. For dates after 1582, however, there is a Gregorian correction: years that are divisible by 100 are not leap years but years divisible by 400, are. So, for instance, 1900 was not a leap year but 2000 was. Expected output (bold is user input) Enter a year: 2008 Enter a month: 29 days Extra credit: if you use a switch statement for this question, we will give you 5pt extra creditStep 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