Question
C++ In this exercise you must write a function that prints a Month calendar starting from the first_column, which is the day number ranging from
C++
In this exercise you must write a function that prints a Month calendar starting from the first_column, which is the day number ranging from Sunday=0 to Saturday=6 and the number_of_days in the month (usually 28-31). Functions that print their results have names like print_results, print_calendar, display_array, show_values.
Sample Output
Number of days: 30 Weekday of first day (0 = Sunday): 4 Su Mo Tu We Th Fr Sa 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 HINT: Code that formats output uses #include
#include
const int DAYS_PER_WEEK=7;
/** TODO: Implement the function to print the calendar. Prints a monthly calendar with a separate row for each week. @param first_column the column of the first day @param number_of_days the number of days */
int main() { int days, weekday; cout << "Number of days: " << endl; cin >> days; cout << "Weekday of first day (0 = Sunday): " << endl; cin >> weekday; cout << " Su Mo Tu We Th Fr Sa" << endl; print_calendar(weekday, days); return 0; }
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