3 ms·
For the confused: the year changes each time, so you need to recheck IsLeapYear each time. But I wouldn't do it with a define but rather: while (days > (days_
by ars 18y ago
For the confused: the year changes each time, so you need to recheck IsLeapYear each time.
But I wouldn't do it with a define but rather:
while (days > (days_in_year = IsLeapYear(year) ? 366 : 365)) { days -= days_in_year; year += 1; }