fifth commit

master
unknown 6 years ago
parent add2dd2e9d
commit a28772489b

@ -1,13 +0,0 @@
void why(int E)
{
switch(E)
{
case 1: printf("该日星期一\n");break;
case 2: printf("该日星期二\n");break;
case 3: printf("该日星期三\n");break;
case 4: printf("该日星期四\n");break;
case 5: printf("该日星期五\n");break;
case 6: printf("该日星期六\n");break;
case 7: printf("该日星期日\n");break;
}
} /*****判断输入日期是星期几*****/

@ -0,0 +1,75 @@
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;
}
Loading…
Cancel
Save