Counting Number of days from year zero

I have to write this function

int totDay(int m, int d, int y);

The function returns the total number of days for the given month, day and year from date zero. The teacher gave us a hint (initialize the total to the number of julian days in given year, then add to the total number of days in each year preceding the given year.)

This is my julian day function, it works.

Code:

`int julianDay(int month, int day, int year)`

{

if (theMonth == 1)

theJulian = theDay;

if (theMonth == 2)

theJulian = theDay + 31;

if (theMonth == 3)

theJulian = theDay + 31 + 28;

if (theMonth == 4)

theJulian = theDay + 31 + 28 + 31;

if (theMonth == 5)

theJulian = theDay + 31 + 28 + 31 + 30;

if (theMonth == 6)

theJulian = theDay + 31 + 28 + 31 + 30 + 31;

if (theMonth == 7)

theJulian = theDay + 31 + 28 + 31 + 30 + 31 + 30;

if (theMonth == 8)

theJulian = theDay + 31 + 28 + 31 + 30 + 31 + 30 + 31;

if (theMonth == 9)

theJulian = theDay + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 1;

if (theMonth == 10)

theJulian = theDay + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30;

if (theMonth == 11)

theJulian = theDay + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31;

if (theMonth == 12)

theJulian = theDay + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30;

return theJulian;

}

what i dont understand to do is the part where it says

add to total the number of days in each year preceding the given year

Any ideas?