using namespace std;
Int leapyear (int year)//judgment leap year
{
If (year %==0 400 | | (year % 100!=0& & Year % 4==0)) return 1;
The else return 0;
}
Int judgemonth (int the month)//judgment on size
{
If (1 month==| | the month==3 | | the month==5 | | the month==7 | | the month==8 | | the month==10 | | the month==12) return 1;
Else if (the month==4 | | 6 month==| | 9 month==| | the month==11) return 0;
Else if (the month==2) return 2;
}
During the int countday (int, int the month, int day//calculation for the first day of the year that
{
Int count_day=0;
for(int i=1; i
If (judgemonth (I)==1) count_day=count_day + 31;
Else if (I==2 & amp; & Leapyear (year)==1) count_day=count_day + 29;
Else if (I==2 & amp; & Leapyear (year)==0) count_day=count_day + 28;
Else if (judgemonth (I)==0) count_day=count_day + 30;
}
Return count_day + day;
}
The class CDate
{
Private:
Int nYear, nMonth nDate;
Public:
CDate (int y, int m, int d)
{
NYear=y;
NMonth=m;
NDate=d;
}
CDate (const CDate& X)
{
NYear=x.n Year;
NMonth=x.n Month;
NDate=x.n Date;
}
Void setnYear (int x)
{
NYear=x;
}
Void setnMonth (int x)
{
If (x>=1 & amp; & x<=12) nMonth=x;
The else cout<& lt;" The error "& lt;
Void setnDay (int x)
{
If ((leapyear (nYear)==1 & amp; & NMonth==2 & amp; & x<29) | | (leapyear (nYear)==0 & amp; & NMonth==2 & amp; & x<28))
NDate=x;
Else if ((judgemonth (nMonth)==1 & amp; & x<=31) | | (judgemonth (nMonth)==0 & amp; & x<=30))
NDate=x;
The else cout<& lt;" Error "& lt;
Int getnYear (void)
{
Return nYear.
}
Int getnMonth (void)
{
Return nMonth;
}
Int getnDate (void)
{
Return nDate;
}
Int operator - (const CDate& X)
{
Int D_value_day;
Int D_value_year=nYear - x.n Year;
If (D_value_year==0)
{
D_value_day=countday (nYear nMonth, nDate) - countday (x.n Year, x.n Month, x.n Date);
}
Else if (D_value_year & gt; 0)
{
D_value_day=countday (nYear nMonth, nDate) + 365 - countday (x.n Year, x.n Month, x.n Date);
If (leapyear (x.n Year)==1) D_value_day=D_value_day + 1;
For (int I=x.n Year + 1; i
If (leapyear (I)==1) D_value_day=D_value_day + 366;
The else D_value_day=D_value_day + 365;
}
}
Else if (D_value_year & lt; 0)
{
D_value_day=365 - countday (nYear nMonth, nDate) + countday (x.n Year, x.n Month, x.n Date);
If (leapyear (nYear)==1) D_value_day=D_value_day + 1;
For (int I=nYear + 1; i
If (leapyear (I)==1) D_value_day=D_value_day + 366;
The else D_value_day=D_value_day + 365;
}
}
If (D_value_day & gt;=0)
{
Return D_value_day;
}
Else if (D_value_day & lt; 0)
{
The return - D_value_day;
}
}
CDate operator++ (void)
{
If (nMonth==12 & amp; & NDate==31)
{
NYear=nYear + 1;
NMonth=1;
NDate=1;
}
The else
{
If (judgemonth (nMonth)==1 & amp; & NDate==31)
{
NMonth=nMonth + 1;
NDate=1;
}
Else if (judgemonth (nMonth)==0 & amp; & NDate==30)
{
NMonth=nMonth + 1;
NDate=1;
}
Else if (judgemonth (nMonth)==2)
{
If (leapyear (nYear)==1 & amp; & NDate==28) nDate==29;
Else if ((leapyear (nYear)==0 & amp; & NDate==28) | | (leapyear (nYear)==1 & amp; & NDate==29))
{
NMonth=nMonth + 1;
NDate=1;
}
}
The else nDate=nDate + 1;
}
}
CDate operator - (void)
{
If (countday (nYear nMonth, nDate)==1)
{
NYear=nYear - 1;
NMonth=12;
NDate=31;
}
The else
{
If (nMonth==1) nDate=nDate - 1;
Else if (judgemonth (nMonth - 1)==1 & amp; & NDate==1)
{
NMonth=nMonth - 1;
NDate=31;
}
Else if (judgemonth (nMonth - 1)==0 & amp; & NDate==1)
{
NMonth=nMonth - 1;
NDate=30;
}
Else if (judgemonth (nMonth - 1)==2 & amp; & NDate==1)
{
NMonth=2;
If (leapyear (nYear)==1) nDate=29;
Else if (leapyear (nYear)==0) nDate=28;
}
The else nDate=nDate - 1;
}
}
};
Int main ()
{
Int number;
Int y, m, d;
While (cin> Number> Y> M> D)
{
CDate day1 (y, m, d);
If (number==2)
{
Int y2, m2, d2;
cin> Y2 & gt;> M2 & gt;> D2.
CDate day2 (y2, m2, d2);
Cout
Else if (number==1)
{
Int k;
cin> k;
If (k>=0)
{
for(int i=0; i
Day1. Operator++ ();
}
}
Else if (k<0)
{
for(int i=0; i<- k; + + I)
{
Day1. Operator -- -- ();
}
}
Cout