0

Hi guys. I have been working at this for several hours. I'm still a novice in C++.

The program I need to write is suppose to calculate the day number for a given day represented by three type int values. It also needs a function that returns true if the first date is greater than the second date. If not, it is suppose to swap the dates and perform the necessary calculations in a different function.

So far what I have is:

```
#include <iostream>
using namespace std;
int isFirstDateGreaterThanSecond();
int getDayNumber(int day1, int month1, int year1);
int getDaysBetweenDatess(int day, int month, int year, int day2, int month2, int year2);
const int SENTINEL = 1799;
void main()
{
int year1, month1, day1, year2, month2, day2, numberDays1, numberDays2, day;
cout << "This program finds the day number of a certain date entered by the user, and the number of days between it and another input date given by the user." << endl;
cout << "Please enter a date between 1800 and 2100 in order of month, day, year. (ex: 6 25 1987) . Enter 1799 in any parameter to exit the program." << endl;
cin >> month1 >> day1 >> year1;
while(month1 < 1 || month1 > 12 || day1 < 1 || day1 > 31 || year1 < 1800 || year1 > 2100)
{
cout << "You have entered an invalid date. Please try again. Enter 1799 to exit the program." << endl;
cin >> month1 >> day1 >> year1;
}
getDayNumber(day1, month1, year1);
cout << day;
cout << "Please enter another date (ex: 2 28 2007)." << endl;
cin >> month2 >> day2 >> year2;
}
int getDayNumber(int day1, int month1, int year1)
{
int a, y, m, julianDay, day, julianDay2;
a = (14 - month1) / 12;
y = year1 + 4800 - a;
m = month1 + 12 * a - 3;
julianDay = day1 + (153 * m + 2) / 5 + y * 365 + y / 4 - y/100 + y/400 - 32045;
}
```

The main problem I am having is wrapping my brain around how to go about making it calculate the day number. Ideally it takes the julianDate and subtracts the juliandate of Dec. 31st of the previous year. Anyone able to give me a little push in the right direction?