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
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
}
}
Your approach is a bit of a headache. I'm not saying it won't work, but nesting loops like that is too complex.
You could define a Month class that'll have header()
and getLine(int lineNumber)
methods.
You can also have a Quarter
class that'll have header()
and getLine(int lineNumber)
methods. It'll contain three Month objects.
You can then loop through your Quarter
objects (4 in a year) and print the header followed by 6 lines.
You are missing one loop.
Outer loop goes from leftmost month to righmost month (3 in total). But that will give you just one line.
You have to wrap it with another loop that will go through all the lines.