Calendar for the year

I have made the code to where it makes the calendar for a month, now I need to find a way to loop it for a year when inputed. It should display all the months. Any help on how to do that? Here's the code for the month.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 void print_calendar(int month, int year)
{
    //print out month name, year
    monthName(int (month));
    int start_day = dayOfWeek( month, 1, year );
    cout << setw(4) << "SUN" << setw(4) << "MON" << setw(4) << "TUE" << setw(4) << "WED" << setw(4) << "THU" << setw(4) << "FRI" << setw(4) << "SAT" << endl;
    for ( int i = 0; i < start_day; i++ )
    cout << setw(4) << " ";
    int max_day = daysInMonth( month, year );
    for (int i = 1; i <= max_day; i++ )
    {
        cout << setw(4) << i;
        if ((i + start_day ) % 7 == 0 )//one week per line
            cout << endl;
    }
    cout << endl;
}
1
2
3
4
5
6
7
8
void print_calendar( int year )
{
	
	for( int month = 1; month < 13; month++ )
	{
		// your code here
	}
}
Last edited on
It's been a long day, lol. Thanks for the help, man. I literally had that but month was 'i'... I'm just not in it right now. Thanks again!
Topic archived. No new replies allowed.