### 题目描述

#include <iostream>
using namespace std;
class Time
{
public:
Time(){};
Time(int ,int ,int);
void display();
Time operator+(int s);
private:
int hour;
int minute;
int second;
};
Time::Time(int h,int m,int s):hour(h),minute(m),second(s){};
void Time::display()
{
cout<<hour<<":"<<minute<<":"<<second<<endl;
}
Time Time::operator+(int s)
{
/*
补充部分
*/
}
int main()
{
int hour,minute,second;
int sec;
cin>>hour>>minute>>second;
cin>>sec;
Time t(hour,minute,second);
t=t+sec;
t.display();
return 0;
}

### 输出

hour:minute:second

23 59 59
2

0:0:1

### 代码如下

``````
#include <iostream>
using namespace std;
class Time
{
public:
Time(){};
Time(int ,int ,int);
void display();
Time operator+(int s);
private:
int hour;
int minute;
int second;
};
Time::Time(int h,int m,int s):hour(h),minute(m),second(s){};
void Time::display()
{
cout<<hour<<":"<<minute<<":"<<second<<endl;
}
Time Time::operator+(int s)
{    Time t;
t.second=second+s;
t.minute=minute+t.second/60;
t.second%=60;
t.hour=hour+t.minute/60;
t.minute%=60;
t.hour/=60;
return t;

}
int main()
{
int hour,minute,second;
int sec;
cin>>hour>>minute>>second;
cin>>sec;
Time t(hour,minute,second);
t=t+sec;
t.display();
return 0;
}
``````