# I need help with a C++ program!

I'm looking to figure out this problem:
Define a structure called DATE with three fields, each of which is an integer: one for the month, one for the day and one for the year, and write a function called increment that accepts a date structure, increments the date by one day and returns the new date. If the
date is the last day of the month, then the month field also must be changed. If the month is 12 (December) and the day is 31, then the value of the year field must also be changed. (Remember a year is a leap year if it is evenly divisible by 4 but not by 100 or it is evenly
divisible by 400.) Finally, build a complete program that reads a particular date and prints the next date.

• Ok, how about I do the class, and you learn how to use it and go from there?
[code]
/*
1. January 31
2. Febuary 28/29
3. March 31
4. April 30
5. May 31
6. June 30
7. July 31
8. August 31
9. September 30
10. October 31
11. November 30
12. December 31//*/

class DATE
{
private:
short day; //1 - 31
short month; //1 - 12
short year; //1900 - End of time...
public:
//Constructors
DATE();
DATE(short d, short m, short y);

//Accessors
DATE next_day() const; //Returns the date post to date sent
bool leap() const;
short month_days() const;
short c_day() const;
short c_month() const;
short c_year() const;
};

////////////////////////////////////////////////////////////////////////////

//Constructors...
DATE::DATE()
{
day = 1;
month = 1;
year = 1900;
}

DATE::DATE(short d, short m, short y)
{
day = d;
month = m;
year = year;
}

//Accessors...
DATE DATE::next_day() const
{
//Takes care of the months with 30 days.....
if (month_days() == 30)
{
if (day < 30)
{
DATE date(day + 1, month, year);
return date;
}
DATE date(1, month + 1, year);
return date;
}

//Takes care of all the rest of the months expect Febuary...
if (month_days == 31)
{
//Taking care of the happening of a new year...
if (month == 12 && days == 31)
{
DATE date(1, 1, year + 1);
return date;
}

if (day < 31)
{
DATE date(day + 1, month, year);
return date;
}

DATE date(1, month + 1, year);
return date;
}

//Taking care of Febuary...
if ((!leap()) && (day < 28))
{
DATE date(day + 1, month, year);
return date;
}

if ((!leap()) && (day == 28))
{
DATE date(1, month + 1, year);
return date;
}

if ((leap()) && (day == 28))
{
DATE date(day + 1, month, year);
return date;
}

if ((leap()) && (day == 29))
{
DATE date(1, month + 1, year);
return date;
}
}

bool leap() const
{
if (year % 4 == 0)
return true;
return false;
}

short month_days() const
{
if (month == 2)
{
if (leap())
return 29;
return 28;
}

if ((month == 9)||(month == 4)||(month == 6)||(month == 11))
return 30;
return 31;
}

short c_day() const
{
return day;
}

short c_month() const
{
return month;
}

short c_year() const
{
return year;
}[/code]

This is just something that came to me right away. I am not for sure if it has bugs of even if the logic is correct. But this will at least give you an idea of what to do...