2011-11-30, 03:11 PM
this is more about coding style
I'd prefer
I could be wrong, I coded c++ before but not C
add on:
say comparing 2011 Dec 1 and 2012 Jan 1
You cannot just add 365/366 days base on the year2 > year1
Code:
while(year1 < year2)
{
[B] days_in_year = if_leap(year1);
if(days_in_year == 1)[/B]
days_until += 366;
else days_until += 365;
++year1;
}I'd prefer
Code:
while(year1 < year2)
{
[B] if(isLeap(year1))[/B]
days_until += 366;
else days_until += 365;
++year1;
}I could be wrong, I coded c++ before but not C
add on:
say comparing 2011 Dec 1 and 2012 Jan 1
You cannot just add 365/366 days base on the year2 > year1

