杭电OJ 2629(C++)

Identity Card

#include<iostream>
using namespace std;
#include<string>

int main()
{
	string a,b;
	int i,n,day,month,year;
	cin>>n;
	for(i = 0 ; i < n ; i++)
	{
		cin>>a;
		if(a[0] == '3' && a[1] == '3')
			b = "Zhejiang";
		if(a[0] == '1' && a[1] == '1')
			b = "Beijing";
		if(a[0] == '7' && a[1] == '1')
			b = "*";
		if(a[0] == '8' && a[1] == '1')
			b = "*";
		if(a[0] == '8' && a[1] == '2')
			b = "Macao";
		if(a[0] == '5' && a[1] == '4')
			b = "Tibet";
		if(a[0] == '2' && a[1] == '1')
			b = "Liaoning";
		if(a[0] == '3' && a[1] == '1')
			b = "Shanghai";
		//year = (a[6] - 48) * 1000 + (a[7] - 48) * 100 + (a[8] - 48) * 10 + (a[9] - 48);
		//month = (a[10] - 48) * 10 + (a[11] - 48);
		//day = (a[12] - 48) * 10 + (a[13] - 48);
		cout<< "He/She is from " << b << ",and his/her birthday is on "<< a[10] << a[11] << "," << a[12] << a[13] << "," << a[6] << a[7] << a[8] << a[9] << " based on the table."<<endl;
	}
	
	return 0;
}

上一篇:js-静态、原型、实例属性


下一篇:7-54 二叉树的基本运算 (10 分)