[c++]代码库
#include "stdafx.h"
#include"iostream"
using namespace std;
class Clock
{
private:
int hour, minute, second;
public:
void setTime(int newH,int newM,int newS);//函数原型说明
void showTime(); //函数原型说明
};
void Clock::setTime(int newH, int newM, int newS)
{
hour = newH;
minute = newM;
second = newS;
}
void Clock::showTime()
{
cout << hour << "时" << minute << "分" << second << "秒" << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
Clock cc;
cc.setTime(20, 03, 519);
cc.showTime();
return 0;
}
//2014年4月22日20:05:28
//31行
[代码运行效果截图]