C语言编万年历,写得好还有送的,只要速度,在线等

来源:百度知道 编辑:UC知道 时间:2024/06/06 19:13:58
要求: 模仿现实生活中的挂历.
当前页以系统当前日期的月份为准显示当前月的每一天(显示出日及对应的星期几).
当系统日期变到下一月时,系统自动翻页到下一月.
要在VC++的环境下写的
最好在附加上函数的说明

#include<stdio.h>
#include<time.h>
int leap (int year)//判断闰年
{
if(year%4==0&&year%100!=0||year%400==0)
return 1;
else return 0;
}
int days_month (int month,int year)//判断月
{
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
return 31;
if(month==4||month==6||month==9||month==11)
return 30;
if(month==2&&leap(year)==1) return 29;
else return 28;
}
int firstday(int month,int year)//判断年
{
int w;
w=(1+2*month+3*(month+1)/5+year+year/4+year/400-year/100)%7+1;
return w;
}
main()
{
//调用系统时间
time_t tval;
struct tm *now;
tval = time(NULL);
now = localtime(&tval);
printf("现在时间: %4d年 %d月 %02d日 %d:%02d:%02d\n", now->tm_year+1900, now->tm_mon+1, now->tm_mday,
now->tm_hour, now->