You may want to use an array with the number of days for each month. Each month is numbered 0 -11 (January is 0 and December is 11), so your array might look like this:
months[0] = 31; // January
months[1] = 28; // February; if not a leap year
months[2] = 31; // March
months[3] = 30; // April
...and so forth. Hope this helps.
|