11 11 1111 12 12 1212
Sample Output
01 01 1999 is earlier than 02 02 1999 11 11 1111 is earlier than 12 12 1212
解:
#if !defined __DAY__h__ #define __DAY__h__ #include
#include\#include
Day::Day(int a, int b, int c) { }
int Day::Break(void) { }
istream &operator>>(istream &input,Day &s)
if(day==0&&mon==0&&year==0)
return 0; else return 1; mon=a; day=b; year=c;
friend istream & operator>>(istream &input,Day &s); friend ostream & operator<<(ostream &output,Day &s); Day(int a=0,int b=0,int c=0); int Break(void); int operator<(Day &s); int day; int mon; int year;
public:
private:
{ }
ostream &operator<<(ostream &output,Day &s) { }
int Day::operator<(Day &s) {
if(s.mon>12||s.mon<=0) { }
else if(s.day>31) { } else { }
else if((s.year%4==0||(s.year0!=0&&s.year@0==0))&&s.day>29&&s.mon==2) { }
else if((!(s.year%4==0||(s.year0!=0&&s.year@0==0)))&&s.day>28&&s.mon==2) { }
if(mon>12||mon<=0) { }
cout<<\您输入的月份错误!\< cout<<\您输入的日期错误!\< cout<<\您输入的日期错误!\< cout<<\您输入的日期错误!\< cout<<\您输入的日期错误!\< cout<<\您输入的月份错误!\< output< input>>s.mon>>s.day>>s.year; return input; \< if((s.mon==1||s.mon==3||s.mon==5||s.mon==7||s.mon==8||s.mon==10||s.mon==12)&&s.day>31) } else if(day>31) { } else if((mon==1||mon==3||mon==5||mon==7||mon==8||mon==10||mon==12)&&day>31) { } { } if((!(year%4==0||(year0!=0&&year@0==0)))&&day>28&&mon==2) { } if(year if(mon if(day cout<<\您输入的日期错误!\< cout<<\您输入的日期错误!\< else if((year%4==0||(year0!=0&&year@0==0))&&day>29&&mon==2) cout<<\您输入的日期错误!\< cout<<\您输入的日期错误!\< #include Day a,b; cout<<\若要退出请输入:\\n0 0 0\< cout<<\请输入要进行比较的两个具体的日期(格式为:mon day year):\< } cin>>a>>b; while(a.Break()!=0) { } return 0; re=a if(re==1) { } if(re==-1) { } cin>>a>>b; cout<