这题是一个字符串模拟水题,给12级学弟学妹们找找自信的,嘿嘿;
题目意思就是要你讲身份证的上的省份和生日解析出来输出就可以了:
http://acm.hdu.edu.cn/showproblem.php?pid=2629
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n,t;
string home,a;
cin>>n;
for(int k = ; k < n ; k++)
{
cin>>a;
t = (a[]-'')*+a[]-'';
switch(t)
{
case :home = "Beijing";break;
case :home = "Shanghai";break;
case :home = "Liaoning";break;
case :home = "Zhejiang";break;
case :home = "Tibet";break;
case :home = "*";break;
case :home = "*";break;
case :home = "Macao";break;
default :break;
}
cout<<"He/She is from "<<home<<",and his/her birthday is on "
<<a[]<<a[]<<","<<a[]<<a[]<<","<<a[]<<a[]<<a[]<<a[]
<<" based on the table."<<endl;
}
return ;
}