commit 073453f59eb0897ab5408d13f26e81d96e32d602 Author: unknown <18408000527@stu.hut.edu.cn> Date: Fri Jan 4 09:41:03 2019 +0800 first commit diff --git a/年历(年、月份).cpp b/年历(年、月份).cpp new file mode 100644 index 0000000..92578db --- /dev/null +++ b/年历(年、月份).cpp @@ -0,0 +1,40 @@ +#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; +}