need help creating a loop

We are creating something that gets the next day of a day that is entered, but with also a loop, i need something that will end the command when i will press -1, its confusing because first i enter in the days and days cant be -1.

#include <iostream>
using namespace std;

void instructions(){
cout << "This program gives the next day of any particular month of";
cout << " any given year," << endl;
cout << "Given the months(1..12) and year >> 1899 to 3000." << endl << endl;
}

int getcYear(){
int number(0);
while ( number < 1899 || number > 3000 ){
cin >> number;
}
return number;
}

int getcMonth(){
int number(0);
while( number < 1 || number > 12){
cin >> number;
}
return number;
}

bool isLeap(int year){
return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
}

int daysInFebruary(int year){
int days(28);
if (isLeap(year) == true)
days = 29;
return days;
}

int daysInMonth( int Month, int year ) {
int days(0);
if (Month == 2)
days = daysInFebruary(year);
else if (Month == 9 || Month == 4 || Month == 6 || Month == 11)
days = 30;
else
days = 31;
return days;
}

int getcDay( int Month, int year) {
int days(0);
while ( days < 1 || days > daysInMonth( Month, year) ){
cin >> days;
return days;
}}


void getnextDate( int &Month, int &year, int &days) {
if ( (Month == 12) && (days == 31) && (year == year) )
{Month = Month - 11; days = days - 30; year = year + 1;}
else if ((Month == 9 || Month == 4 || Month == 6 || Month == 11) && (days == 30))
{ Month = Month + 1; days = days - 29; year == year;}
else if ((Month == 1 || Month == 3 || Month == 5 || Month == 7 || Month == 8 || Month == 10) && (days == 31) )
{Month = Month + 1; days = days - 30; year == year;}
else if ((Month == 2) && (daysInFebruary(year)== 28))
{Month = Month + 1; days = days - 27; year == year;}
else if ((Month == 2) && (daysInFebruary(year)== 29))
{Month = Month + 1; days = days - 28; year == year;}
else days = days + 1;
}

void outputResults( int year, int Month, int days){
cout << endl;
cout << Month << "/" << days;
cout <<"/" << year;
cout << endl << endl;
}


int main(){

int year(0);
int Month(0);
int days(0);
int date(0);

instructions();
while ( true ){
days = getcDay(Month, year);
Month = getcMonth();
year = getcYear();
getnextDate( Month, year, days);
outputResults( year, Month, days);
}
system("Pause");
return 0;

}
Hint to getting help: No one is going to waste time trying to decipher unformatted code. Use the code tags. :)
Topic archived. No new replies allowed.