master
unknown 6 years ago
parent e34776f6eb
commit df69d4d968

@ -58,17 +58,16 @@ int weekday(int V) //
int holiday(int F,int G) //判断该天是否为法定节日
{
if(F==1&&G==1) printf("\n当天为元旦");
else if(F==5&&G==1) printf("\n当天为劳动节");
else if(F==6&&G==1) printf("\n当天为儿童节");
else if(F==8&&G==1) printf("\n当天为建军节");
else if(F==10&&G==1) printf("\n当天为国庆节");
else if(F==5&&G==1) printf("\n当天为劳动节\n");
else if(F==6&&G==1) printf("\n当天为儿童节\n");
else if(F==8&&G==1) printf("\n当天为建军节\n");
else if(F==10&&G==1) printf("\n当天为国庆节\n");
else
printf("\n当天不是法定节日");
}
using namespace std;
int main(void)
int P()
{
int year,d,j,Z,ds,dd,m,n,D,x,y,z,h,k,l,B,Z1;
@ -76,19 +75,19 @@ int main(void)
scanf("%d",&year);
if((year%4==0&&year%100!=0)||year%400==0)
{
printf("\n 该年是闰年");
printf("\n=========该年是闰年=========");
printf("\a");
}
else
{
printf("\n 该年是平年");
printf("\n=========该年是闰年=========");
printf("\a");
}
Z=Y(year);
for(j=1;j<=12;j++)
{
d=Z%7;
printf("\n-----------------------------\n");
printf("\n----------------------------\n");
printf(" %d月份\n",j);
printf("SUN MON TUE WED THU FRI SAT\n");
if(d<6)
@ -115,7 +114,7 @@ int main(void)
Z=Z+D;
}
d=Z%7;
printf("\n-----------------------------\n");
printf("\n----------------------------\n");
printf(" %d月份\n",j);
printf("SUN MON TUE WED THU FRI SAT\n");
if(d<6)
@ -131,6 +130,102 @@ int main(void)
if(dd==6-d||(dd-6+d)%7==0||dd==month(year,j))
printf("\n");
}
}
int main(void)
{
int year,d,j,Z,ds,dd,m,n,D,x,y,z,h,k,l,B,Z1,C;
printf("\n***********年历显示***********");
printf("\n 1. 查询年历\n 2. 查询具体月份\n 3. 具体日期\n 4. 日期间距\n");
printf("******************************\n");
printf("\n请输入对应数字以执行相应操作:");
scanf("%d",&C);
if(C==1)
{
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感谢您的使用!");
}
if(C==2)
{
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");
}
printf("\n感谢您的使用!");
}
if(C==3)
{
printf("\n输入年月日:");
scanf("%d%d%d",&x,&y,&z);
Z=Y(x);
for(j=1;j<=y-1;j++)
{
D=month(x,j);
Z=Z+D;
}
Z=Z+z;
Z1=Y(h);
d=Z%7;
weekday(d);
holiday(y,z);
printf("\n感谢您的使用!");
}
if(C==4)
{
printf("\n输入年月日:");
scanf("%d%d%d",&x,&y,&z);
Z=Y(x);
@ -152,7 +247,10 @@ int main(void)
B=Z1-Z;
printf("\n输入日期距今有%d天\n",B);
d=Z%7;
weekday(d);
holiday(y,z);
printf("\n感谢您的使用!");
}
if(C!=1&&C!=2&&C!=3&&C!=4)
printf("\n请重启并输入正确数字");
}

Binary file not shown.
Loading…
Cancel
Save