Question
Please update my code: You should implement the functions in this order: void printMonthYear(int mon) There are no tricks to this function. void printDaysOfWeek() There
Please update my code:
You should implement the functions in this order:
void printMonthYear(int mon)
There are no tricks to this function.
void printDaysOfWeek()
There are no tricks to this function.
int getFirstDayOfMonth(int mon, int year)
Read about Zeller's algorithm here. Here is the pseudo code for Zellers algorithm:
declare adjusted month, set to (mon + 9) % 12 + 1
declare adjusted year, set to year - 2000
if adjusted year is greater than 10:
subtract one from year
declare day, set to 1
declare century, set to 20
declare output, set to
(13 * mon - 1) / 5 + year / 4 + century / 4 + day + year - 2 * century;
mod output by 7
add 7 to output
mod output by 7 again
return output
int getNumOfDaysInMonth(int mon, int year)
There are no tricks to this function. Use if statements as needed. Dont worry about leap years.
void printDays(int mon, int year)
You will need to call getFirstDayOfMonth to know how many spaces to insert at the beginning of the month.
You will need to call getNumOfDaysInMonth to know how many days are in the month.
Do not copy your previous C code for printing a calendar.
Implement the pseudocode as follow (this will make your life easier when writing x86):
declare dayOfWeeek, set to call getFirstDayOfMonth
for 0 to dayOfWeek:
print 3 spaces
declare daysInMonth, set to call GetNumOfDaysInMonth
for 1 to daysInMonth:
print the number of the day
if (i + dayOfWeek) % 7 == 0:
print newline
print newline
The output should look like this:
1 #includeStep 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