#include<stdio.h>
void printdate(int year,int month,int day)
{
int B;
if((year%4==0&&year%100!=0)||year%400==0)
B=29;
else
B=28;
switch(month)
{
case 1:if(day<=31)
printf("January %d,%d\n",day,year);
else
printf("错误\n");
break;
case 2:if(day<=B)
printf("February %d,%d\n",day,year);
else
printf("错误\n");
break;
case 3:if(day<=31)
printf("March %d,%d\n",day,year);
else
printf("错误\n");
break;
case 4:if(day<=30)
printf("April %d,%d\n",day,year);
else
printf("错误\n");
break;
case 5:if(day<=31)
printf("May %d,%d\n",day,year);
else
printf("错误\n");
break;
case 6:if(day<=30)
printf("June %d,%d\n",day,year);
else
printf("错误\n");
break;
case 7:if(day<=31)
printf("July %d,%d\n",day,year);
else
printf("错误\n");
break;
case 8:if(day<=30)
printf("August %d,%d\n",day,year);
else
printf("错误\n");
break;
case 9:if(day<=31)
printf("September %d,%d\n",day,year);
else
printf("错误\n");
break;
case 10:if(day<=30)
printf("October %d,%d\n",day,year);
else
printf("错误\n");
break;
case 11:if(day<=31)
printf("Nevember %d,%d\n",day,year);
else
printf("错误\n");
break;
case 12:if(day<=30)
printf("December %d,%d\n",day,year);
else
printf("错误\n");
break;
default:if(day<=31)printf("错误\n");
}
}
int main()
{
int y,m,d;
while(1)
{
scanf("%d%d%d",&y,&m,&d);
printdate(y,m,d);
}
return 0;
}
第三章第三十六题
最新推荐文章于 2023-11-27 19:43:08 发布