你有身份证吗?但无论如何您一定有身份证号码。从身份证号码上可以得到每个人的具体个人信息。身份证号码有18位,其中前17位包含特殊的特殊含义: 前6位代表你来自的区域,然后8位代表你的生日。其他4位代表什么?你可以百度一下。
以下是本题中可能用到的地区的代码。
在身份证号码中,可能只有33出现,0000是由其他数字取代。
这是塞缪尔的身份证号码331004198910120036你能告诉我他来自哪里吗? 最初的两位表示他来自浙江省,19891012表示是他的生日日期(年/月/日)。
Input
输入包含两部分:
第一行为一个整数n,代表有n组数据
接下来为测试数据,每一行为一个代表身份证号码的字符串。
Output
根据题目描述,输出他来自哪里和他的出生日期。具体格式可以参照样例输出。
Sample Input
1
330000198910120036
Sample Output
He/She is from Zhejiang,and his/her birthday is on 10,12,1989 based on the table.
这里写代码片#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int n;
char p[20];
scanf("%d",&n);
char a[20];
while(n--)
{
scanf("%s",a);//输入一个字符串a,接下来访问其中的字符。
if(a[0]=='3'&&a[1]=='3')
strcpy(p,"Zhejiang");
else if(a[0]=='1'&&a[1]=='1')
strcpy(p,"Beijing");
else if(a[0]=='7'&&a[1]=='1')
strcpy(p,"Taiwan");
else if(a[0]=='8'&&a[1]=='2')
strcpy(p,"Macao");
else if(a[0]=='5'&&a[1]=='4')
strcpy(p,"Tibet");
else if(a[0]=='2'&&a[1]=='1')
strcpy(p,"Liaoning");
else if(a[0]=='3'&&a[1]=='1')
strcpy(p,"Shanghai");
else if(a[0]=='8'&&a[1]=='1')
strcpy(p,"Hong Kong");
printf("He/She is from %s,and his/her birthday is on %c%c,%c%c,%c%c%c%c based on the table.\n",p,a[10],a[11],a[12],a[13],a[6],a[7],a[8],a[9]);
}
return 0;
}