很操蛋的题,月份和日必须用字符串读取和输出,即如果是1月1号的话,输出是01,01,。。。。。
#include <stdio.h>
#include <stdlib.h>
#define P(n) printf(n);break;
int main()
{
char day[3], mouth[3], s[5];
int n, from, year;
scanf("%d", &n);
while(n--)
{
scanf("%2d%4s%4d%2s%2s%4s", &from, s, &year, mouth, day, s);
printf("He/She is from ");
switch(from)
{
case 33:
P("Zhejiang");
case 11:
P("Beijing");
case 71:
P("Taiwan");
case 81:
P("Hong Kong");
case 82:
P("Macao");
case 54:
P("Tibet");
case 21:
P("Liaoning");
case 31:
P("Shanghai");
}
printf(",and his/her birthday is on %s,%s,%d based on the table.\n", mouth, day, year);
}
return 0;
}