#include<bits/stdc++.h>
using namespace std;
class Time
{
int month,day,hour,minute;
public:
Time(){
month=0;day=0;hour=0;minute=0;
}
Time(int month1,int day1,int hour1,int minute1):month(month1),day(day1),hour(hour1),minute(minute1){}
Time & operator = (const Time & t){
month=t.month;
day=t.day;
hour=t.hour;
minute=t.minute;
}//重载等号
friend ostream & operator<<(ostream&os,const Time&t);
friend istream & operator>>(istream&is,Time&t);
void setmonth(int month1){month=month1;}
int getmonth(){return month;}
void setDay(int day1){day=day1;}
int getDay(){return day;}
void setHour(int hour1){hour=hour1;}
int getHour(){return hour;}
void setMinute(int minute1){minute=minute1;}
int getMinute(){return minute;}
// void display();
};
ostream & operator<<(ostream&os,const Time&t){
os<<t.month<<" ";
os<<t.day<<" ";
os<<t.hour<<" ";
os<<t.minute;
return os;
}
istream & operator>>(istream&is,Time&t){
is>>t.month>>t.day>>t.hour>>t.minute;
return is;
}
//bool operator < (const Time&t){
//return month!=month?month<t.month:day!=t.day?day<t.day:hour!=hour?hour<t.hour:minute!=t.minute?minute<t.minute;
//if(month<t.month&&day<t.day)
// return true;
// else return false;
//}
/*void Time::display(){
cout<<month<<" "<<day<<" "<<hour<<" "<<minute<<endl;
}*/
int main()
{
//freopen("in.dat","r",stdin);
//freopen("out.dat","w",stdout);
/* int month,day,hour,minute;
cin>>month>>day>>hour>>minute;
Time t1(month,day,hour,minute);
cin>>month>>day>>hour>>minute;
Time t2(month,day,hour,minute);
t1.display();
t2.display();
*/
Time t1;
cin>>t1;
Time t2;
cin>>t2;
cout<<t1<<endl;
cout<<t2<<endl;
return 0;
}
STL ATM时间类
最新推荐文章于 2023-10-01 08:30:00 发布