Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a c++ program that, when given a starting day (Sunday through Saturday) as

ID: 3648762 • Letter: W

Question

write a c++ program that, when given a starting day (Sunday through Saturday) as a string, and a four-digit year, prints a calendar for that year. each month should contain the name of the month, centered over the dates for that month and a line containing the names of the days of the week, running from sunday to saturday. Each week should be printed on a separate line. Be careful to check for a leap year. Instead of using case, use array to make the calendar. As the output, the calendar must display the days of the week in its full name for example(Monday Tuesday...). The calendar also has to be wide as if it was a wall calendar.








Explanation / Answer

#include #include #include using std::cout; using std::cin; using std::endl; using std::boolalpha; using std::string; using std::setw; //Function prototypes int leaptest(int); string calheader(int, int); int days(int, int); int weekday(int, int); //Sets up a bool to test for leapyears bool leapyear; int main() { // Initialize space for month and year input int month, year; //Asks for input cout > month >> year; int day, dayofweek, leapyeartest; //Calls leaptest function sending year leaptest(year); // creates a string for real month string realmonth; //calls the function that prints header info calheader(month, year); // calls days function days(month, year); // calls function to find out days of week weekday(month, year); //for (int counter = 0; counter