C语言程序 显示当天日期

来源:互联网 发布:erp软件二次开发 编辑:程序博客网 时间:2024/06/07 11:49
#include <stdio.h>#include <time.h>void put_date(void){time_t current;struct tm *local;char wday_name[][7]={"日","一","二","三","四","五","六"};time(&current);local=localtime(&current);printf("%4d年%2d月%02d日星期%s",local->tm_year+1900,local->tm_mon+1,local->tm_mday,wday_name[local->tm_wday]);}void main(){printf("今天是:");put_date();putchar('\n');}

原创粉丝点击