杭电OJ 2629(C++)

2021/7/16 11:24:08

本文主要是介绍杭电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 = "Taiwan";
		if(a[0] == '8' && a[1] == '1')
			b = "Hong Kong";
		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;
}



这篇关于杭电OJ 2629(C++)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程