用c++编写的程序来获取目前电脑上显示的的时间这程序怎么写

[复制链接]
查看11 | 回复3 | 2011-3-5 18:33:53 | 显示全部楼层 |阅读模式
//方案— 优点:仅使用C标准库;缺点:只能精确到秒级 #include#includeint main( void ) { time_t t = time(0); char tmp[64]; strftime( tmp, sizeof(tmp), "%Y/%m/%d %X %A 本年第%j天 %z",localtime(&t) ); puts( tmp ); return 0; } size_t strftime(char *strDest, size_t maxsize, const char *format, const struct tm *timeptr);
回复

使用道具 举报

千问 | 2011-3-5 18:33:53 | 显示全部楼层
# include int __stdcall wWinMain( __in HINSTANCE , __in_opt HINSTANCE , __in_opt LPWSTR , __in int){ SYSTEMTIME time = { 0 }; ::GetLocalTime(&time);
//这个函
回复

使用道具 举报

千问 | 2011-3-5 18:33:53 | 显示全部楼层
调用GetTime()函数。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行