编程论坛
注册
登录
编程论坛
→
C++教室
用C++编程
csurice
发布于 2005-03-30 12:51, 822 次点击
各位大姐大哥,
谁能用C++编写一个从电脑上读取时间的程序么。
小弟我是初学者也不知道能不能啊!
1 回复
#2
傲视
2010-03-26 18:38
#include<iostream>
#include<ctime>
using namespace std;
int main()
{
char str[80];
struct tm *stm;
time_t t;
t=time(NULL);
stm=localtime(&t);
strftime(str,80,"Today is %A,day %d of %B in the year %Y.\n",stm);
printf(str);
//getchar();
return 0;
}
1