Question: c++ Write a program in C++ that displays the calendar for a given month of the year. The program prompts the user to enter the

c++

Write a program in C++ that displays the calendar for a given month of the year. The program prompts the user to enter the year and the month, and then displays the entire calendar for the month.

This date can be any date after Jan, 1800 (the start day). First it will check that this is a valid date, and output a message if it is not (for example, August, 1731). It might also turn out useful to know that Jan 1st, 1800 was a Wednesday. Your program should repeat the above process, until the user no longer wants to continue.

(Hint: You need to consider about if the year is leap year. The code to determine whether a year is a leap year is:

if (( year % 400 ==0) || ((year % 4 ==0) && (year % 100 !=0)))

return true;

else

return false;

Your program must be organized using functions. The following is a list of functions that your program should include. You cannot call or use any built-in methods or other library.

  • This function returns true if the year passed is a leap year, and returns false otherwise bool isLeapYear(int year);

  • This function returns the number of days in the given month and year int getNumOfDaysInMonth(int month, int year);

  • This function returns the days since the Jan 1st, 1800. int getTotalNumOfDays(int month, int day, int year);


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!