diff --git a/年历.cpp b/年历.cpp index 4e89305..d7acb3d 100644 --- a/年历.cpp +++ b/年历.cpp @@ -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) @@ -130,8 +129,104 @@ int main(void) printf(" "); if(dd==6-d||(dd-6+d)%7==0||dd==month(year,j)) printf("\n"); + } } - 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); for(j=1;j<=y-1;j++) @@ -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ÇëÖØÆô²¢ÊäÈëÕýÈ·Êý×Ö"); } + diff --git a/年历.exe b/年历.exe index 66078c3..5510d09 100644 Binary files a/年历.exe and b/年历.exe differ