Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions