#include <stdio.h>
typedef int Is;
Is leap_year(int year)
{
if((year%4==0&&year%100!=0)||(year%400==0)) return 1;
else return 0;
}
void main()
{
int year,month,day,sum=0;
printf("输入年份:");
scanf("%d",&year);
printf("输入月份:");
scanf("%d",&month);
printf("输入日子:");
scanf("%d",&day);
switch(month)
{
case 12:sum+=30;
case 11:sum+=31;
case 10:sum+=30;
case 9:sum+=31;
case 8:sum+=31;
case 7:sum+=30;
case 6:sum+=31;
case 5:sum+=30;
case 4:sum+=31;
case 3:leap_year(year)?(sum+=29):(sum+=28);
case 2:sum+=31;
case 1:sum+=day;
default :break;
}
printf("这是第%d天。\n",sum);
}
typedef int Is;
Is leap_year(int year)
{
if((year%4==0&&year%100!=0)||(year%400==0)) return 1;
else return 0;
}
void main()
{
int year,month,day,sum=0;
printf("输入年份:");
scanf("%d",&year);
printf("输入月份:");
scanf("%d",&month);
printf("输入日子:");
scanf("%d",&day);
switch(month)
{
case 12:sum+=30;
case 11:sum+=31;
case 10:sum+=30;
case 9:sum+=31;
case 8:sum+=31;
case 7:sum+=30;
case 6:sum+=31;
case 5:sum+=30;
case 4:sum+=31;
case 3:leap_year(year)?(sum+=29):(sum+=28);
case 2:sum+=31;
case 1:sum+=day;
default :break;
}
printf("这是第%d天。\n",sum);
}