Calendar

I want to write a program that prints the calendar for any inputted month of any year. But somewhere along the program, I input today's date (in terms of month and year), but the output does not come out correctly. Any suggestions?

Last edited on
What did you input? What did you get? What did you expect? Why did you expect that?
closed account (48T7M4Gy)
Enter a month and year between 1/1901 and 12/2099: 10/2015
Calendar: October, 2015
Sun Mon Tue Wed Thu Fri Sat
  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 
Do you want to print another calendar? (Y/N):  
In function 'int main()': 62:5: warning: 'numdays' may be used uninitialized in this function [-Wmaybe-uninitialized]


This was from cpp.sh with all the warnings turned on.
First, I input 1/1901 to see if the first day falls on Tuesday. And the output does show that.
Second, I input 2/1901 to see if the calendar follows the order.
But when I input 10/2015, it doesn't show the correct monthly calendar. 10/2015 shold start on a Thursday. So that's where I don't know what went wrong with my program.
(year - 1901)%4; it should be (year - 1901)/4;
Topic archived. No new replies allowed.