Explore BrainMass

C++ Program to display calendar of any month

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

Write a program that prompts the user to enter the year and the month and displays on the console the calendar table for the month.

For example, if the user entered 2011 for the year, and 5 for the month, the program should display the calendar for May 2011, as shown for December month in the attached picture.

Example of program action (in the console numbers are formatted to be exactly under the week days):

Enter Year: 2011
Enter Month: 5

May 2011
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

© BrainMass Inc. brainmass.com March 21, 2019, 9:35 pm ad1c9bdddf


Solution Preview

Please find attached C++ file (main.cpp), compiled and tested using Visual ...

Solution Summary

C++ program to display the calendar table for an year. Program prompts for year and month and displays calendar for this month in a console. The program will take into account leap years, different number of days in the months and will evaluate the first day of the week.