#include <iostream>
#include <cstdlib>
using namespace std;
class CDate {
int m_nDay;
int m_nMonth;
int m_nYear;
public:
CDate() {};
CDate(int year, int month, int day)
{
SetDate(year, month, day);
};
void Display();
void AddDay();
void SetDate(int year, int month, int day)
{
m_nYear = year;
m_nMonth = month;
m_nDay = day;
};
~CDate() {};
private:
bool IsLeapYear();
};
void CDate::Display()
{
cout << m_nDay << "/" << m_nMonth<< "/" <<m_nYear << endl;
}
bool CDate::IsLeapYear()
{
if (((m_nYear % 4 == 0) && (m_nYear % 100 != 0))
|| (m_nYear % 400 == 0))
return true;
else
return false;
}
void CDate::AddDay()
{
//此处补全代码
/***********************************begin****************/
if ((m_nMonth == 1 || m_nMonth == 3 || m_nMonth == 5 || m_nMonth == 7 || m_nMonth == 8 || m_nMonth == 10) && (m_nDay == 31))
{
m_nDay = 1;
m_nMonth ++;
}
if (m_nMonth == 12 && m_nDay == 31)
{
m_nDay = 1;
m_nMonth = 1;
m_nYear ++;
}
if ((m_nMonth == 4 || m_nMonth == 6 ||m_nMonth == 9 || m_nMonth == 11) && m_nDay == 30)
{
m_nDay = 1;
m_nMonth ++;
}
if ((m_nMonth== 2 && ((m_nYear% 4 == 0 && m_nYear % 100 != 0)|| (m_nYear % 400 == 0))) && m_nDay == 29)
{
m_nDay = 1;
m_nMonth ++;
}
if ((m_nMonth == 2 && ((m_nYear % 4 != 0) || (m_nYear % 100 == 0 &&m_nYear & 400 != 0))) && m_nDay == 28)
{
m_nDay = 1;
m_nMonth ++;
}
/***********************************begin****************/
}
int main()
{
int year, month, day;
//cout << "Please Input Current date:";
cin >> year >> month >> day;
CDate d(year, month, day);
d.Display();
d.AddDay();
cout << "Add 1 to Current date:";
d.Display();
return 0;
}