Quote Originally Posted by userxbw View Post
first thought, without actually writing code to check it.

drop it into your switch.

using this information,

you only have to worry about what? one month adding one day to it. so, all you got a do is worry about number 2 on your switch.being feb.
Code:

switch (month)
{
case 1:
....
break;
case 2:
if ( Leap_or_not_leap( year) == 0 )
do your math for leap year
else
do your math for not leap year, 
or whatever functions you got set up to handle that.
break;
case 3:
...
break;
........
default:
     break;
} // end switch
Function:
int Leap_or_not_leap( int year)
{
  if  leap year  
   return 0;
 else
   return 1;
}
adjust everything accordingly.

I hope you see what I did there.
Hmmm, so if you calculate the day of 10th of February (month == 2), you add one day if the year is a leap year.
So 10th of Feb is normaly day 41, but in a leap year it is day 42?
And 1st of March? Normaly day 60. And in a leap year? With your code it is also day 60.
If the year is a leap year, you must add 1 day if the month is greater then 2!

And your information about leap year is wrong. Not every year that can be devided by 4 is a leap year.
This is true in Julian system, but not in Gregorian system.
But you can built in a check for calendar system.
The important date is Friday, 15th October 1582.
All dates before should be calculated according Julian system and all dates thereafter in Gregorian system.