Post-Lab - Lab (7) - A Calendar

Write a C++ program that prints a calendar for a given year.  You can use the program ex74.cpp as the starting point.  The program prompts the user for three inputs:

1) The year for which you are generating the calendar.
2) The day of the week that January first is on, you will use the following notation to set the day of the week:

0  Sunday                     1  Monday                   2  Tuesday                   3 Wednesday
4  Thursday                 5  Friday                      6  Saturday

3) The output file name.

Your program should generate a calendar similar to the one shown in the example output below.  The calendar should be printed into the output file.  Your program should be able to handle leap years. A leap year is a year in which we have 366 days.  That extra day comes at the end of February. Thus, a leap year has 366 days with 29 days in February.  A century year is a leap year if it is divisible by 400.  Other years divisible by 4 but not by 100 are also leap years.

Example: Year 2000 is a leap year because it is divisble by 400.   Year 2004 is a leap year because it is divisible by 4 but not by 100.

You can use as many functions as you wish.  Your program should clearly describe the functionality of each function and should display the instructions on how to run the program.

Sample Input:

Enter the name of the output file: cal2004
Enter the year for which you wish to generate the calendar: 2004
Enter the day of the week that January first is on:  4

Sample output:

Calendar for year 2004

January
Sun      Mon     Tue      Wed     Thu      Fri        Sat
1          2          3
4          5          6          7          8          9          10
11        12        13        14        15        16        17
18        19        20        21        22        23        24
25        26        27        28        29        30        31

February
Sun      Mon     Tue      Wed     Thu      Fri        Sat
1          2          3          4          5          6          7
…        ..          ..          ..          ..          ..          ..
..          ..
..
..