Hi guys, trying to get a day number from 1 - 366 for a specific date.
I've been working on this for a while. I can't seem to figure out. I'm not asking for an answer, just a push in the right direction. So far here is what I have for code:
#include <iostream>
using namespace std;
void main()
{
int a, y, m, year, month, yearBefore, day;
int day1;
int julianDay = 0;
cin>>month>>day>>year;
for(yearBefore=year; yearBefore >= (year-1); yearBefore--)
{
a = (14 - month) / 12;
y = yearBefore + 4800 - a;
m = month + 12 * a - 3;
julianDay = day + (153 * m + 2) / 5 + y * 365 + y / 4 - y/100 + y/400 - 32045;
if(day1 = 0)
{
day1 += julianDay;
}
if(day1 > julianDay)
{
day1 -= julianDay;
}
day = 31;
month = 12;
}
cout << day1;
}
I keep trying to find a way to get it to subtract the second julian day from the first. Please help!