December 5th, 2012, 09:41 AM
Display a monthly calendar
I need to write a function that displays the days of a specified month. I have been looking for sample code but haven't had much luck. Here are the guidelines for the function:
Write a void function named displayCalendarDays. This function is passed two input parameters. The first parameter is an int that represents the start day. Start days are numbered from 0 to 6 with 0 representing Sunday and 6 representing Saturday. The second parameter is an int that represents the number of days in the month. If the start day is not in the range 0 to 6 or if the number of days is not in the range 1 to 31, the program should display a helpful error message instead of displaying a calendar. If the parameters are OK, the program should display a calendar similar to the following:
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
After the last day of the calendar is displayed, the function should advance the cursor to the next line.
Note that for the display above, the start day is 3 and the numbers of days is 31.
Can someone please help me with this? The posting format is off the month should start on wensday.
Last edited by Les2012; December 5th, 2012 at 09:42 AM.
Reason: formatting problem
December 5th, 2012, 12:22 PM
Re: Display a monthly calendar
Yes, of course!
Originally Posted by Les2012
Show us what you have already done (your code) and explain what problems do you have and with what parts?
Click Here to Expand Forum to Full Width