Calendar Help

And problem solved, thanks Nico!!!
Last edited on
You have a bug in 2016, January 31st will be printed in an extra column next to the week instead of on a new line.
To fix this you could replace line 180 with:
 
if(j%7 == 0) // 7 || j == 14 || j == 21 || j == 28) 

That will print the new line every time that j can be divided exactly by 7.

To get the next month to continue you should update the firstday variable when you are done printing the numbers of the previous month. In order to do this, firstday needs to become global (or you will have to return it).

Global variables are not pretty, so you should probably call printDays and provide the first argument by reference. Then after the for loop has completed you can add for example:
 
firstday = (firstday + day)%7;

to calculate the new first day for the next month.

Kind regards, Nico
Thanks!!!
Topic archived. No new replies allowed.