#include <stdio.h>
int main()
{
int year = 2008;
int month = 8;
int day = 8;
int date=0;
switch(month)
{
case 2:date+=31;
case 3:date+=28;
case 4:date+=31;
case 5:date+=30;
case 6:date+=31;
case 7:date+=30;
case 8:date+=31;
case 9:date+=31;
case 10:date+=30;
case 11:date+=31;
case 12:date+=30;
break;
}
date+=day;
if(year%100!=0||year%400==0&&year%4==0)
{
if(month>2)
{
date++;
}
}
printf("%d年%d月%d日是该年的第%d天",year,month,day,date);
return 0;
}
date只是表示了每个月的第一天是这一年的第多少天啊。还得加上几号的天数啊
好像有date+=day
而且我差的好远,才一百六十几...