#include<iostream>
using namespace std;
class Time
{
private:
int hour,minute,second;
public:
Time(int h,int m,int s);
friend Time&operator++(Time &t);//返回引用是为了实现连续自增
void display();
};
Time::Time(int h,int m,int s):hour(h),minute(m),second(s)
{
if(hour>=24)hour=0;
if(minute>=60)minute=0;
if(second>=60)second=0;
}
void Time::display()
{
cout<<hour<<":"<<minute<<":"<<second<<endl;
}
Time &operator++(Time &t)
{
++t.second;
if(t.second>=60)
{
t.second=0;
++t.minute;
&nbs
using namespace std;
class Time
{
private:
int hour,minute,second;
public:
Time(int h,int m,int s);
friend Time&operator++(Time &t);//返回引用是为了实现连续自增
void display();
};
Time::Time(int h,int m,int s):hour(h),minute(m),second(s)
{
if(hour>=24)hour=0;
if(minute>=60)minute=0;
if(second>=60)second=0;
}
void Time::display()
{
cout<<hour<<":"<<minute<<":"<<second<<endl;
}
Time &operator++(Time &t)
{
++t.second;
if(t.second>=60)
{
t.second=0;
++t.minute;
&nbs