Issue with looping forwards

后端 未结 3 1614
灰色年华
灰色年华 2021-01-26 21:03

so I\'m having an issue with my loops, where the intention is to fill through the whole months before moving to the next line, like so

     January   2000                


        
3条回答
  •  青春惊慌失措
    2021-01-26 21:21

    As Perdi Estaquel saied, you've missed one more loop.

    for (month = 1; month < 12;) {
    }
    

    only enables days output once a month, and you need to do it like this.

    for (month = 1; month < 12;) {
        // month and header output stay unchanged
    
        for (int calendarLine = 1; calenderLine <= 5; calenderLine++) {
            // your calender output here
        }
    }
    

提交回复
热议问题