C显示系统时间

来源:互联网 发布:聚拢 内衣 知乎 编辑:程序博客网 时间:2024/05/16 07:13
#include<stdio.h>#include<time.h>void main(){ time_t tim;    struct tm *at;    char now[40];    time(&tim);    at=localtime(&tim);    strftime(now,40,"%Y%m%d\n",at);    puts(now);    at->tm_mon+=3;     strftime(now,40,"%Y%m%d\n",at);    puts(now); }
显示当前系统时间和三个月的系统时间
0 0
原创粉丝点击