C++ 时钟类实现:设计与功能
#include
void setClock(int h,int m,int s){
hour=h;
minute=m;
second=s;
}
void showTime(){
cout<<hour<<':'<<minute<<':'<<second<<endl;
}
};
int main(){ Clock c1(12,30,45); c1.showTime(); c1.setClock(15,20,10); c1.showTime();
Clock c2;
c2.showTime();
c2.setClock(8,0,0);
c2.showTime();
return 0;
}
原文地址: https://www.cveoy.top/t/topic/l4tF 著作权归作者所有。请勿转载和采集!