Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C Programming Create a calendar that allows the user to print a calendar for a month or entire year. Modify calmonth(), calyear(), and main(). Be
C Programming
Create a calendar that allows the user to print a calendar for a month or entire year.
Modify calmonth(), calyear(), and main().
Be Aware of:
- Leap years.
- Invalid months from user input.
- Invalid years from user input.
- You'll have to modify the main() method a bit.
Leap Year Algorithm
It is a leap year if divisible by 4, except for years divisible by 100. But, if the year is divisible by 400, it is a leap year.
Code:
#include#include #include // y > 1752, 1 >= m >= 12 int dow(int y, int m, int d) { static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; y -= m Expected Output:Aprii 2019 S M T W T F S 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 $ ./mycal -y 2019 January 2019 S M T W T F S 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 February 2019 3 4 5 6 78 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 March 2019 S M T W T F S 3 4 5 6 78 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Aprii 2019 S M T W T F S 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 $ ./mycal -y 2019 January 2019 S M T W T F S 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 February 2019 3 4 5 6 78 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 March 2019 S M T W T F S 3 4 5 6 78 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
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