📄 asctime.cpp
字号:
//asctime.cpp
#include <iostream.h>
#include <string.h>
#include <time.h>
#include <conio.h>
void main(void)
{
tm t; //t为tm的结构变量
char str[80];
/* sample loading of tm structure */
t.tm_sec = 1; /* Seconds */
t.tm_min = 30; /* Minutes */
t.tm_hour = 9; /* Hour */
t.tm_mday = 5; /* Day of the Month */
t.tm_mon = 11; /* Month */
t.tm_year = 52; /* Year - does not include century */
t.tm_wday = 4; /* Day of the week */
t.tm_yday = 0; /* asctime 不显示*/
t.tm_isdst= 0; /* 夏时制时间不使用在此函数 */
/* 转换为字符串 */
strcpy(str, asctime(&t));
cout << str;
/*直接输出*/
cout << asctime(&t);
getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -