# Day number program

Discussion in 'C' started by songweaver, Mar 25, 2009.

1. ### songweaverNew Member

Joined:
Mar 3, 2009
Messages:
2
0
Trophy Points:
0
I need help with Day Number program, I have already got the Leap Year subprogram to work, but I need help with the day number program as far as how to set it up and incorporate the leap year program. Here is the scenario and below that the leap year subprogram.

Write a function dayNumber that returns the day number (1 to 366) in a year for a date that is provided as input data. Your function should accept the month (1 through 12), day, and year as integers. As an example. For example, January 1, 1994 is day one. December 31 2004 is day 366 because its a leap year. A leap year is divisible 4, except that any year is divisible by 100 is a leap year only if it is divisible by 400. Write a second function that returns true if its argument, a year, is a leap year.

Also I cannot use loops or arrays of any sort. Just calling on these subprograms. Any help would be much appreciated!

Code:
```#include <iostream>

using namespace std;

bool checkLeapYr(int year)
{
if ((year%4==0) && (year %100!= 0) || (year%400 == 0))

{
return true;

}
else
{
return false;
}
}
```

Joined:
Aug 6, 2004
Messages:
3,012