标准答案,经VS++6.0测试
#include <stdio.h>
int man()
{
int year=2008;
int month=8;
int day=8;
switch(month-1) /*8月本身不能算在其中,所以要减一,在switch中如果想算一共多少天就不能使用break跳出。*/
{
case 11:day +=30;
case 10:day +=31;
case 9 :day +=30;
case 8 :day +=31;
case 7 :day +=30;
case 6 :day +=31;
case 5 :day +=30;
case 4 :day +=31;
case 3 :day +=30;
case 2 :
if((year%100!=0 && year%4==0) || year%400==0)
{
day +=29;
}
else
{
day +=28;
}
case 1:day +=31;
break;
}
printf("是该年第几天",day);
}