标题:[求助]怎样得到系统时间
只看楼主
stylev
Rank: 1
等 级:新手上路
威 望:1
帖 子:136
专家分:0
注 册:2006-5-30
得分:0 
#include <iostream>
#include <ctime>

using namespace std;

class TimeDate
{
	public:
		TimeDate(time_t t);
		void show();
	private:
		struct tm *timeS;
};

TimeDate::TimeDate(time_t t)
{
	timeS=localtime(&t);
}

void TimeDate::show()
{
	 cout<< timeS->tm_hour << endl;
	 cout << timeS->tm_min << endl;
	 cout << timeS->tm_sec  << endl;
}

int main(void)
{
	time_t x;
	x=time(0);
	TimeDate ob(x);
	ob.show();
	return 0;
}


E-mail/MSN: stylev@
2006-05-31 18:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-29180-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.078481 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved