h6.cpp~

来自「刮大风歌但范甘迪给对方 但范甘迪分给对方国的国的风格」· CPP~ 代码 · 共 66 行

CPP~
66 行
字号
using namespace std;class Time{private: 	int h, m, s;public:	Time(int hx = 0, int mx = 0, int sx = 0);	Time& increaseSecond(int s);       //增加	Time& increaseMinute(int m);       //增加分	Time& increaseHour(int h);         //增加小时	bool equal(const Time& temp);           //判定是否相等	void print();                      //输出};Time::Time(int hx, int mx, int sx){	h=hx;	m=mx;	s=sx;}Time& Time::increaseSecond(int s){	this->s+=s;	if(this->s<60)		return *this;	else	{		this->s-=60;		this->m++;	}	}Time& Time::increaseMinute(int m){	this->m+=m;	if(this->m<60)		return *this;	else	{		this->m-=60;		this->h++;	}} Time& Time::increaseHour(int h){	this->h+=h;	if(this->h<=24&&this->h>=0)		return *this;}bool Time::equal(const Time& temp){	if(s==temp.s&&m==temp.m&&h==temp.h)		return true;	else		return false;}void Time::print(){	cout<<"Now it's"<<h<<":"<<m<<":"<<s<<endl;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?