Question: Problem 2 Write the following program in c++. Write a function names DaysOfMonth with two parameters, which are the month and year, to display number
Problem 2 Write the following program in c++.
Write a function names DaysOfMonth with two parameters, which are the month and year, to display number of days.(Finding the number of days in a month)
Write a main function to prompt the user to enter the year and month in this order, and call function DaysOfMonth to display the number of days in the month.
For example, if the user entered month 2 and year 2000, the program should display that February 2000 has 29 days. If the user entered month 3 and year 2005, the program should display that March 2005 has 31 days.
(Hint: the number of days in February for different year may be different, which depends on whether it is a leap year or plain year. A year is leap year if either (1) or (2) holds: (1) it is divisible by 400. (2)it is divisible by 4 but not divisible by 100)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
