You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cwf_106/年历(年、月份).cpp

41 lines
603 B

#include <stdio.h>
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;
}