|
|
@ -63,81 +63,17 @@ int holiday(int F,int G) //
|
|
|
|
else if(F==8&&G==1) printf("\n当天为建军节\n");
|
|
|
|
else if(F==8&&G==1) printf("\n当天为建军节\n");
|
|
|
|
else if(F==10&&G==1) printf("\n当天为国庆节\n");
|
|
|
|
else if(F==10&&G==1) printf("\n当天为国庆节\n");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
printf("\n当天不是法定节日");
|
|
|
|
printf("\n当天不是法定节日\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace std;
|
|
|
|
int P()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int year,d,j,Z,ds,dd,m,n,D,x,y,z,h,k,l,B,Z1;
|
|
|
|
|
|
|
|
printf("\n输入你所查寻日历的年份:");
|
|
|
|
|
|
|
|
scanf("%d",&year);
|
|
|
|
|
|
|
|
if((year%4==0&&year%100!=0)||year%400==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("\n=========该年是闰年=========");
|
|
|
|
|
|
|
|
printf("\a");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("\n=========该年是闰年=========");
|
|
|
|
|
|
|
|
printf("\a");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Z=Y(year);
|
|
|
|
|
|
|
|
for(j=1;j<=12;j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
d=Z%7;
|
|
|
|
|
|
|
|
printf("\n----------------------------\n");
|
|
|
|
|
|
|
|
printf(" %d月份\n",j);
|
|
|
|
|
|
|
|
printf("SUN MON TUE WED THU FRI SAT\n");
|
|
|
|
|
|
|
|
if(d<6)
|
|
|
|
|
|
|
|
for(ds=1;ds<=d+1;ds++)
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
for(dd=1;dd<=month(year,j);dd++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf ("%d",dd);
|
|
|
|
|
|
|
|
if (dd<10)
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
if (dd==6-d||(dd-6+d)%7==0||dd==month(year,j))
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Z=Z+month(year,j);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("\n输入所查日历的年月:");
|
|
|
|
|
|
|
|
scanf("%d%d",&m,&n);
|
|
|
|
|
|
|
|
Z=Y(m);
|
|
|
|
|
|
|
|
for(j=1;j<=n-1;j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
D=month(m,j);
|
|
|
|
|
|
|
|
Z=Z+D;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
d=Z%7;
|
|
|
|
|
|
|
|
printf("\n----------------------------\n");
|
|
|
|
|
|
|
|
printf(" %d月份\n",j);
|
|
|
|
|
|
|
|
printf("SUN MON TUE WED THU FRI SAT\n");
|
|
|
|
|
|
|
|
if(d<6)
|
|
|
|
|
|
|
|
for(ds=1;ds<=d+1;ds++)
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
for(dd=1;dd<=month(year,j);dd++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("%d",dd);
|
|
|
|
|
|
|
|
if(dd<10)
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
if(dd==6-d||(dd-6+d)%7==0||dd==month(year,j))
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int year,d,j,Z,ds,dd,m,n,D,x,y,z,h,k,l,B,Z1,C;
|
|
|
|
int year,d,j,Z,ds,dd,m,n,D,x,y,z,h,k,l,B,Z1,C;
|
|
|
|
printf("\n***********年历显示***********");
|
|
|
|
Chongfu:
|
|
|
|
printf("\n 1. 查询年历\n 2. 查询具体月份\n 3. 具体日期\n 4. 日期间距\n");
|
|
|
|
printf("\n■■■■■■■年历显示■■■■■■■");
|
|
|
|
printf("******************************\n");
|
|
|
|
printf("\n■ 1. 查询年历 ■\n■ 2. 查询具体月份 ■\n■ 3. 具体日期 ■\n■ 4. 日期间距 ■\n■ 5. 退出程序 ■\n");
|
|
|
|
|
|
|
|
printf("■■■■■■■■■■■■■■■■■■\n");
|
|
|
|
printf("\n请输入对应数字以执行相应操作:");
|
|
|
|
printf("\n请输入对应数字以执行相应操作:");
|
|
|
|
scanf("%d",&C);
|
|
|
|
scanf("%d",&C);
|
|
|
|
if(C==1)
|
|
|
|
if(C==1)
|
|
|
@ -176,7 +112,8 @@ int main(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Z=Z+month(year,j);
|
|
|
|
Z=Z+month(year,j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("\n感谢您的使用!");
|
|
|
|
printf("\n感谢您的使用!\n");
|
|
|
|
|
|
|
|
goto Chongfu;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(C==2)
|
|
|
|
if(C==2)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -205,7 +142,8 @@ int main(void)
|
|
|
|
if(dd==6-d||(dd-6+d)%7==0||dd==month(year,j))
|
|
|
|
if(dd==6-d||(dd-6+d)%7==0||dd==month(year,j))
|
|
|
|
printf("\n");
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("\n感谢您的使用!");
|
|
|
|
printf("\n感谢您的使用!\n");
|
|
|
|
|
|
|
|
goto Chongfu;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(C==3)
|
|
|
|
if(C==3)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -222,7 +160,8 @@ int main(void)
|
|
|
|
d=Z%7;
|
|
|
|
d=Z%7;
|
|
|
|
weekday(d);
|
|
|
|
weekday(d);
|
|
|
|
holiday(y,z);
|
|
|
|
holiday(y,z);
|
|
|
|
printf("\n感谢您的使用!");
|
|
|
|
printf("\n感谢您的使用!\n");
|
|
|
|
|
|
|
|
goto Chongfu;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(C==4)
|
|
|
|
if(C==4)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -247,10 +186,17 @@ int main(void)
|
|
|
|
B=Z1-Z;
|
|
|
|
B=Z1-Z;
|
|
|
|
printf("\n输入日期距今有%d天\n",B);
|
|
|
|
printf("\n输入日期距今有%d天\n",B);
|
|
|
|
d=Z%7;
|
|
|
|
d=Z%7;
|
|
|
|
printf("\n感谢您的使用!");
|
|
|
|
printf("\n感谢您的使用!\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(C==5)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("\n感谢您的使用!\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(C!=1&&C!=2&&C!=3&&C!=4&&C!=5)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("\n请输入正确数字");
|
|
|
|
|
|
|
|
goto Chongfu;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(C!=1&&C!=2&&C!=3&&C!=4)
|
|
|
|
|
|
|
|
printf("\n请重启并输入正确数字");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|