Write a program that, given a month and year, prints a calendar, such as
June 2016
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
To find out the weekday of the first day of the month, call this function:
/**
Computes the weekday of a given date.
@param year the year
@param month the month (1 = January ... 12 = December)
@param day the day of the month
@return the weekday (0 = Sunday ... 6 = Saturday)
*/
int day_of_week(int year, int month, int day)
{
int y = year;
int m = month - 1;
if (month < 3) { y--; m = m + 4; }
return (y + y / 4 - y / 100 + y / 400
+ 3 * m + 4 - (m - m / 8) / 2 + day) % 7;
}
Make a helper function to print the header and a helper function to print each row.
1
Expert's answer
2018-05-30T17:08:22-0400
Dear Phil, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment