//设计一个时间类Time,它能够完成秒钟的自增运算。 #include using namespace std; class Time{ private: int hour,minute,second; public: Time(int h,int m, int s); Time operator++(); //友元重载需要参数 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; } Time Time::operator++(){ ++second; if (second>=60){ second=0; ++minute; if(minute>=60){ minute=0; ++hour; if(hour>=24) hour=0; } } return *this; } Time operator--(Time &t){ --t.second; if (t.second<0){ t.second=59; --t.minute; if(t.minute<0){ t.minute=59; --t.hour; if(t.hour<0) t.hour=23; } } return t; } void Time::display(){ cout<