由于校赛,OJ将于本周五(5.17)到周日停止服务

Problem 1410. -- Clock类运算符重载

1410: Clock类运算符重载

Time Limit: 1 Sec  Memory Limit: 65535 MB   64bit IO Format: %lld
Submitted: 993  Accepted: 710
[Submit][Status][Web Board]

Description

设计时钟Clock类(成员数据有hour,minute,second)使得下面main函数能够得到正确结果。
int main()
{
    Clock c1(23,59,59),c2,c3;
    c1.Show();    c2.Show();    c3.Show();
    c2=c1+500;  c3=c1-1000;
    c1.Show();    c2.Show();    c3.Show();
    c2=c1++;    c3=++c1;
    c1.Show();    c2.Show();    c3.Show();
    c2=c1--;    c3=--c1;
    c1.Show();    c2.Show();    c3.Show();
    Clock c4(8,21,35),c5(18,21,36);
    c4.Show();    c5.Show();
    cout<<c1-c4<<endl;
    cout<<c4-c5<<endl;
    return 0;
}
注意:提交时只需提交除main函数外的代码部分

Sample Output

23:59:59
0:0:0
0:0:0
23:59:59
0:8:19
23:43:19
0:0:1
23:59:59
0:0:1
23:59:59
0:0:1
23:59:59
8:21:35
18:21:36
56304
-36001

[Submit][Status][Web Board]