Question
Write a program in C++ that prompts the user to enter the year and an integer for the first day of the year (Sunday is
Write a program in C++ that prompts the user to enter the year and an integer for the first day of the year (Sunday is 0, Monday is 1, ., and Saturday is 6) and displays the calendar table for the year. For example, if the user entered the year 2017 and 0 for Sunday, January 1, 2017, your program should display the calendar for each month in the year as follows:
Enter a year: 2017
Enter the first day of the year
(Sunday is 0, Monday is 1, ..., and Saturday is 6): 0
January 2017
---------------------------------------------
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
..
December 2017
-----------------------------------------
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
I am using a switch staement and have the program written for the most part but if you input the years start day, all the months have that start day. I am struggling with how I should fix this so it displays like an actual calendar. Any help is greatly appreciated.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started