Help writing a date calculating code for existing code

Hello guys, I have created a code for the following:
How many days until my next birthday?
However, whenever I run the program and attempt to do the calculation(how many days until my next birthday), it does not give me the correct calculation. I know the problem exists with the calculation, but I have yet to discover what i need to change to allow the code to calculate correctly. I hope you guys can help me.For example, when I enter March 3rd 2013 as the current date and put my next birthday as March 3rd, 2014, it gives me 0 days. If you guys need the main() function, I wont mind posting it.

[code]
case 2:
cout<<"Calculate how many days until your next birthday."<<endl;
cout<<endl;

cout<<"Please enter todays date by day, month."<<endl;
cout<<endl;

cout<<"First date:: "<<endl;
cout<<endl;

cout<<"Day: ";
cin>>first_day;
if(first_day > 31 || first_day <= 0)
{
cout<<"Incorrect day entered"<<endl;
cin.ignore();
return 0;
}
cout<<"Month: ";
cin>>first_month;
if(first_month > 12 || first_month <= 0)
{
cout<<"Incorrect Month entered"<<endl;
cin.ignore();
return 0;
}
cout<<"Year: ";
cin>>first_year;
if(first_year > 9999 || first_year < 0)
{
cout<<"Incorrect Year Entered"<<endl;
cin.ignore();
return 0;
}
cout<<endl;
cout<<"\nPlease enter your birthdate:: "<<endl;
cout<<endl;

cout<<"Day: ";
cin>>second_day;
if(second_day > 31 || second_day <= 0)
{
cout<<"Incorrect day entered"<<endl;
cin.ignore();
return 0;
}
cout<<"Month: ";
cin>>second_month;
if(second_month > 12 || second_month <= 0)
{
cout<<"Incorrect Month entered"<<endl;
cin.ignore();
return 0;
}
cout<<"Year: ";
cin>>second_year;
if(second_year > 9999 || second_year < 0)
{
cout<<"Incorrect Year Entered"<<endl;
cin.ignore();
return 0;
}
/////////////////////////////Months////////////////////////////////////

if(first_month == second_month)
{
months_total = 0;
}
else
{
if(first_month > second_month)
{
for(int i = (first_month - 1); i > (second_month - 1); i--)
{
static int months_total_temp = 0;
months_total_temp += days_in_months[i];
months_total = months_total_temp;
}
}
else
{
for(int i = (first_month - 1); i < (second_month - 1); i++)
{
static int months_total_temp = 0;
months_total_temp += days_in_months[i];
months_total = months_total_temp;
}
}
}

////////////////////////////Days//////////////////////////////////

if (first_day == second_day)
{
days_difference = 0;
days_total = (years_difference + months_total) - days_difference;
}
else
{
if(first_day > second_day)
{
days_difference = first_day - second_day;
days_total = (years_difference + months_total) - days_difference;
}
else
{
days_difference = second_day - first_day;
days_total = (years_difference + months_total) + days_difference;
}
}

/////////////////////////////Years/////////////////////////////////

if(first_year == second_year)
{
years_difference = 0;
}
else
{
if(first_year % 4 == 0 && first_year % 100 != 0 || first_year % 400 == 0)
{
if(second_year % 4 == 0 && second_year % 100 != 0 || second_year % 400 == 0)
{
if(first_year > second_year)
{
years_difference = (first_year - second_year) * (reg_year) + 2;
}
else
{
years_difference = (second_year - first_year) * (reg_year) + 2;
}
if(second_month > first_month)
{
if(days_in_months[first_month - 1] > days_in_months[1])
{
--years_difference;
}
}
}
else
{
if(first_year > second_year)
{
years_difference = (first_year - second_year) * (reg_year) + 1;
}
else
{
years_difference = (second_year - first_year) * (reg_year) + 1;
}
if(first_month > second_month)
{
if(days_in_months[second_month - 1] > days_in_months[1])
{
--years_difference;
}
}
}
}
else
{
if(first_year > second_year)
{
years_difference = (first_year - second_year) * (reg_year);
}
else
{
years_difference = (second_year - first_year) * (reg_year);
}
}
}


//////////////////////////Output//////////////////////////////////

cout<<endl;
cout<<"\nThe total days until your next birthday is: "<<days_total<<endl;
cout<<endl;
cin.get();
cin.ignore();
return 0;
break;
/code]
Topic archived. No new replies allowed.