1 #include<stdio.h> 2 3 typedef struct 4 { 5 char num[6]; 6 char s[10]; 7 } cus; 8 9 cus xx[8]= {{"33","Zhejiang"},{"11","Beijing"}, 10 {"71","Taiwan"},{"81","Hong Kong"}, 11 {"82","Macao"},{"54","Tibet"}, 12 {"21","Liaoning"},{"31","Shanghai"} 13 }; 14 char s[20]; 15 16 int f(int); 17 18 int main() 19 { 20 int n,i; 21 scanf("%d",&n); 22 getchar(); 23 while(n--) 24 { 25 gets(s); 26 for(i=0; i<8; ++i) 27 { 28 if(f(i)) 29 { 30 printf("He/She is from %s,and his/her birthday is on 31 %c%c,%c%c,%c%c%c%c based on the table. ", 32 xx[i].s,s[10],s[11],s[12],s[13],s[6],s[7],s[8],s[9]); 33 break; 34 } 35 } 36 } 37 } 38 39 int f(int k) 40 { 41 int i; 42 for(i=0; i<2; ++i) 43 { 44 if(s[i]!=xx[k].num[i]) 45 break; 46 } 47 if(i!=2) 48 return 0; 49 else 50 return 1; 51 }