声明一个完整的时钟程序
#include<iostream.h>
class Clock
{ public:
void SetTime(int NewH=0, int NewM=0, int NewS=0);
void ShowTime()
private:
int Hour;
int Minute;
int Second;
} ;
void Clock :: SetTime(int NewH,int NewM,int NewS)
{ Hour=NewH;
Minute=NewM;
Second=NewS;
}
inline void Clock ::ShowTime()
{
cout<<Hour<<Minute<<Second;
}
//主函数
void main()
{ Clock Myclock;
Myclock.SetTime();
Myclock.ShowTime();
Myclock.SetTime(8,30,30);
Myclock.ShowTime;
}