main() { int year,month,startDay,days;//分别表示年,月,该月第一天,该月总天数 printf("Please input year and month:"); scanf("%d %d",&year,&month); printf("The result is:\n"); printf("\n\t%d-%d\n",year,month);//格式控制,在中间打印年月 startDay=GetWeekDay(year,month,1); //函数调用 days=GetMonthDays(year,month); PrintMonthCalender(startDay,days); //打印该月日历 system("pause"); }
main() { int year,month,startDay,days,yes_no;//年,月,该月第一天星期几,该月有多少天,是否是闰年 printf("input the year and month<YYYY-MM>:"); scanf("%d-%d",&year,&month); printf(" %d年-%d月\n",year,month);//打印标题YYYY-MM /*调用函数*/ yes_no=CheckLeap ( year); startDay=GetWeekDay (year,month,yes_no); days=GetMonthDay (year,month,yes_no);//值传递和处理 PrintMonthCalender (startDay,days); system("pause"); return 0; }