Question: Write a C++ program that will prompt the user to enter a year and produce a calendar for that year. Do not forget that years

Write a C++ program that will prompt the user to enter a year and produce a calendar for that year. Do not forget that years that are divisible by 4 but not divisible by 100 unless they are divisible by 400 are leap years.

The first day of the year can be calculated using the following formula:

W = ((29 - 2*C + y + y/4 + C/4)%7 + 7) % 7

where

  • Y is the year

  • C = (Y-1) / 100, the century

  • y = (Y-1) % 100

  • / denotes the integer division

  • % denotes the integer remainder (mod)

  • W is the week day (0=Sunday, ..., 6=Saturday)

  • only iostream iomanip and windows.h libraries are allowed.

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!