#include <iostream>
#include <ctime>
using namespace std;
class Alarm{
private:
unsigned int h;
unsigned int m;
unsigned int s;
unsigned int hh;
unsigned int mm;
void talk();//走動
void show();//顯示
public:
Alarm(unsigned int hour, unsigned int minute, unsigned int second, unsigned int hour_a, unsigned int minute_a);//時鐘初始化
void run();//運行
};
Alarm::Alarm(unsigned int hour, unsigned int minute, unsigned int second, unsigned int hour_a, unsigned int minute_a){
this->h=hour;
this->m=minute;
this->s=second;
this->hh=hour_a;
this->mm=minute_a;
}
void Alarm::talk(){
time_t t=time(NULL);
while(time(NULL)==t);
if(++this->s > 59){
this->s=0;
if(++this->m > 59){
this->m=0;
if(++this->h == 24)
this->s = 0;
}
}
}
void Alarm::show(){
cout<<"";
if(this->h<10) cout<<0;
cout<<this->h<<:;
if(this->m<10) cout<<0;
cout<<this->m<<:;
if(this->s<10) cout<<0;
cout<<this->s<<flush;
}
void Alarm::run(){
for(;;){
if(this->hh==this->h && this->mm==this->m){
/*cout<<""<<"a";
cout<<"時間到……"<<endl;
break;*/
cout<<"a";
}
this->talk();
this->show();
}
}
int main(){
Alarm t(10,10,55,10,11);
t.run();
system("PAUSE");
}