diff --git a/年历.cpp b/年历.cpp new file mode 100644 index 0000000..4e89305 --- /dev/null +++ b/年历.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +int Y(int Z) //๫ԪԪԪ1յ +{ + int i,s=0,day; + for(i=1;i<=Z-1;i++) + { + if(i%4==0&&i%100!=0||i%400==0) + day=366; + else + day=365; + s=s+day; + } + return s; +} + +int month(int X,int C) //·ݣƽ꣩ +{ + int V; + switch(C) + { + case 1: V=31;break; + case 2: + if(V%4==0&&V%100!=0||V%400==0) + V=29; + else + V=28; + break; + case 3: V=31;break; + case 4: V=30;break; + case 5: V=31;break; + case 6: V=30;break; + case 7: V=31;break; + case 8: V=31;break; + case 9: V=30;break; + case 10: V=31;break; + case 11: V=30;break; + case 12: V=31;break; + } + return V; +} + +int weekday(int V) //жڼ +{ + switch(V) + { + case 1: printf("\nһ\n");printf("\a");break; + case 2: printf("\nڶ\n");printf("\a");break; + case 3: printf("\n\n");printf("\a");break; + case 4: printf("\n\n");printf("\a");break; + case 5: printf("\n\n");printf("\a");break; + case 6: printf("\n\n");printf("\a");break; + case 7: printf("\n\n");printf("\a");break; + } +} + +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 + printf("\n첻Ƿ"); +} + +using namespace std; + +int main(void) +{ + + 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"); +} + 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; + printf("\n뵱ǰգ"); + scanf("%d%d%d",&h,&k,&l); + Z1=Y(h); + for(j=1;j<=k-1;j++) + { + D=month(k,j); + Z1=Z1+D; + } + Z1=Z1+l; + B=Z1-Z; + printf("\nھ%d\n",B); + d=Z%7; + weekday(d); + holiday(y,z); +} + diff --git a/年历.exe b/年历.exe new file mode 100644 index 0000000..66078c3 Binary files /dev/null and b/年历.exe differ diff --git a/年历(年、月份).cpp b/年历(年、月份).cpp deleted file mode 100644 index 92578db..0000000 --- a/年历(年、月份).cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -int Y(int A) -{ - int i,s=0,day; - for(i=1;i<=A-1;i++) - { - if(i%4==0&&i%100!=0||i%400==0) - day=366; - else - day=365; - s=s+day; - } - return s; -} - -int R(int B,int C) -{ - int T; - switch(C) - { - case 1: T=31;break; - case 2: - if(B%4==0&&B%100!=0||B%400==0) - T=29; - else - T=28; - break; - case 3: T=31;break; - case 4: T=30;break; - case 5: T=31;break; - case 6: T=30;break; - case 7: T=31;break; - case 8: T=31;break; - case 9: T=30;break; - case 10: T=31;break; - case 11: T=30;break; - case 12: T=31;break; - } - return T; -}