Posted on 2003-10-23
I need a program that displays a Gregorian calendar for any year, After Christ (Anno Domini).
The program must do the following:
*Take input from the user for the year and month. If a number between 1 and 12 is entered for the month, print the calendar for that month only. If 0 is entered for the month, print the calendar for the entire year (all 12 months). If a number greater than 12 is entered for month, default it to 0.
*Print each month's name with the month's calendar. Format the output so that the days of the week line up. Hint: When calling printf, putting an integer between % and d in the formatting string will cause printf to print in the width specified by the integer. For example, printf("%2d", x); will print x in a field width of two characters, right-flushed. For more information on printf formatting, refer to the text books.
*It MUST contain at least the following functions:
int leap_year(int yr)
Determines if the given year, yr, is a leap year. Returns 1 if it is; 0, otherwise.
int find_year_day(int year)
Determines the day of the week on which the given year, yr starts and returns it.
int days_in_month(int year, int m)
Determines the number of days in a particular month, m, of a particular year, yr, and returns it.
You do not have to name the functions and arguments/parameters as outlined above. Highly use these suggested
A function that accepts the year from the user, and returns it.
A function that accepts the month from the user, and returns it.
A function that prints the calendar for a given month.
A function that prints the calendar for a give year.
You must provide a prototype of every function in your program in a header file that you include in your source file using the #include directive.