diff --git a/年历完整.c b/年历完整.c new file mode 100644 index 0000000..5369947 --- /dev/null +++ b/年历完整.c @@ -0,0 +1,357 @@ +#include +#include +#include +#include + +// ÿÔÂÌìÊý + +int month_day(int year,int month) +{ + switch(month) + { + case 1: + case 3: + case 5: + case 7: + case 8: + case 10: + case 12: + return 31;break; + + case 4: + case 6: + case 9: + case 11: + return 30;break; + + case 2: + if((year%4==0)&&(year%100!=0)||(year%400==0)) + { + return 29; + break; + } + else + { + return 28; + break; + } + } +} + + +// ÄêÀú + +void year_calendar(int year) +{ + int month,days,weekday,sum_day; + int i,j; + + year; + printf("ÇëÊäÈëÒª²éѯµÄÄê·Ý£º"); + scanf("%d",&year); + for(i=1;itm_year; + now_month=1+p->tm_mon; + now_day=p->tm_mday; + printf("µ±Ç°ÈÕÆÚÊÇ£º%d/%d/%d\n",now_year,now_month,now_day); + //ÊäÈëÈÕÆÚµÄ×ÜÌìÊý + int i,k,sum_day; + printf("ÇëÊäÈëÒª²éѯµÄÄê/ÔÂ/ÈÕ£º"); + scanf("%d/%d/%d",&year,&month,&day); + for(i=1;isum_nowday) + printf("\nÊäÈëÈÕÆÚÓ뵱ǰÈÕÆÚÏà²î%dÌì",sum_day-sum_nowday); + else + printf("\nÊäÈëÈÕÆÚÓ뵱ǰÈÕÆÚÏà²î%dÌì",sum_nowday-sum_day); + +} + +//ÈÕÆÚ²éѯ + +void rq(int year,int month,int day) +{ + printf("ÇëÊäÈëÒª²éѯµÄÄê/ÔÂ/ÈÕ£º"); + int sum_day,i,k,weekday; + scanf("%d/%d/%d",&year,&month,&day); + for(i=1;i