展开全部
【基本题】定义一个时间类,提供设定时间、显示时间和秒数增加e68a8432313133353236313431303231363533313334336361371的功能,其中设定时间的方法需要校验数据的正确性,
并在main函数中验证。
*/
#include
using namespace std;
class Clock
{
public:
void settime(int h,int m,int s);
void showtime();
void add();
Clock(int h=0,int m=0,int s=0);
Clock(const Clock &c);
private:
int hour;
int minute;
int second;
int state;
};
Clock::Clock(int h,int m,int s):hour(h),minute(m),second(s),state(0)
{
}
Clock::Clock(const Clock &c):hour(c.hour),minute(c.minute),second(c.second)
{
}
void Clock::settime(int h,int m,int s)
{
this->hour=h;
this->minute=m;
this->second=s;
if(h>0&am