Assignment 6

Due Monday 15 October at 1am

In this assignment, we will use a loop to print a simple calendar. It begins by asking the user how many days in the month, and the start day (so we don’t have to figure that out from the month and year).

Please save your solution to calendar.cpp in the a06 folder within cs102. (You may have to create this folder.)

Here are three sample runs:

  •  

    Enter number of days in month: 30
    Enter start day (0=Sun, 1=Mon, ..., 6=Sat): 4
     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
  •  

    Enter number of days in month: 31
    Enter start day (0=Sun, 1=Mon, ..., 6=Sat): 0
     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
  •  

    Enter number of days in month: 28
    Enter start day (0=Sun, 1=Mon, ..., 6=Sat): 6
     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