题 号: 140 实现Clock类(C++) 语言要求: C++
实现时钟类Clock,(24小时制,0~23)
在代码中引入头文件 Clock.h
它的定义如下:
#include <iostream>
using namespace std;
class Clock{
public:
Clock(int h,int m, int s);
void SetAlarm(int h,int m,int s);
void run();
void ShowTime(){
cout<<"Now:"<<hour<<":"<<minute<<":"<<second<<endl;
}
private:
int hour; //时
int minute; //分
int second; //秒
int Ahour; //时(闹钟)
int Aminute; //分(闹