输入日期可以输出他是1年中的第几天!
/* Note:Your choice is C IDE */
#include "stdio.h"
main()
{
int year,month,day,er;
printf("please input year month,day:");
scanf("%d%d%d",&year,&month,&day);
if(year%400==0||year%4==0&&year%100!=0) er=29;
else er=28;
switch(month)
{
case 1:
day=day;
break;
case 2:
day=day+31;
break;
case 3:
day=day+31+er;
break;
case 4:
day=day+31+er+31;
break;
case 5:
day=day+31+er+31+30;
break;
case 6:
day=day+31+er+31+30+31;
break;
case 7:
day=day+31+er+31+30+31+30;
break;
case 8:
day=day+31+er+31+30+31+30+31;
break;
case 9:
day=day+31+er+31+30+31+30+31+31;
break;
case 10:
day=day+31+er+31+30+31+30+31+31+30;
break;
case 11:
day=day+31+er+31+30+31+30+31+31+30+31;
break;
case 12:
day=day+31+er+31+30+31+30+31+31+30+31+30;
break;
}
printf("%d",day);
}