int main() { int year,d,j,D,Z,di,did,m,n,x,y,z,h,k,l,jian,Z1; printf("请输入你所查寻日历的年份:"); scanf("%d",&year); Z=how(year); for(j=1;j<=12;j++) { d=Z%7; printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); printf(" %d月份\n",j); printf("sun mon tue wed thu fri sat\n"); if(d<6) for(di=1;di<=d+1;di++) printf(" "); for(did=1;did<=where(year,j);did++) { printf("%d",did); if(did<10) printf(" "); else printf(" "); /*****排版整齐*****/ if(did==6-d||(did-6+d)%7==0||did==where(year,j)) printf("\n"); } Z=Z+where(year,j); } printf("请输入所查日历的年月:"); scanf("%d%d",&m,&n); Z=how(m); for(j=1;j<=n-1;j++) { D=where(m,j); Z=Z+D; } d=Z%7; printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); printf(" %d月份\n",j); printf("sun mon tue wed thu fri sat\n"); if(d<6) for(di=1;di<=d+1;di++) printf(" "); for(did=1;did<=where(year,j);did++) { printf("%d",did); if(did<10) printf(" "); else printf(" "); if(did==6-d||(did-6+d)%7==0||did==where(year,j)) printf("\n"); } printf("输入年月日:"); scanf("%d%d%d",&x,&y,&z); Z=how(x); for(j=1;j<=y-1;j++) { D=where(x,j); Z=Z+D; } Z=Z+z; printf("输入当前年月日:"); scanf("%d%d%d",&h,&k,&l); Z1=how(h); for(j=1;j<=k-1;j++) { D=where(k,j); Z1=Z1+D; } Z1=Z1+1; jian=Z1-Z; if(jian<0) jian=-jian; /*****转成正数*****/ printf("输入日期距今有%d天\n",jian); d=Z%7; why(d); when(y,z); system("pause"); /*****强制暂停*****/ return 0; }