简单题

给出身份证号 判断住址 和出生年月

熟练字符串的操作

主要是string::substr(s, l)//s:起始位置 l长度

 #include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <map>
#include <fstream> using namespace std; map<string,string> m;
int main()
{
m[""] = "Zhejiang";
m[""] = "Beijing";
m[""] = "Taiwan";
m[""] = "Hong Kong";
m[""] = "Macao";
m[""] = "Tibet";
m[""] = "Liaoning";
m[""] = "Shanghai";
int T;
freopen("in.txt", "r", stdin);
ifstream cin ("in.txt");
scanf("%d", &T);
getchar();
while (T--)
{
char buff[];
string id, from;
string yy, mm, dd;
gets(buff);
id = buff;
from = id.substr(, );
yy = id.substr(, );
mm = id.substr(, );
dd = id.substr(,);
cout << "He/She is from " << m[from] << ",and his/her birthday is on " <<mm<<"," <<dd <<"," <<yy <<" based on the table."<<endl;
}
}

最新文章

  1. 关于char的定义语句,正确的有()
  2. velocity模板入门
  3. 强大的数据恢复软件--EasyRecovery专业版
  4. ConfigParser读取记事本、notepad++修改后的配置文件会出现:ConfigParser.MissingSectionHeaderError
  5. 网站开发常用jQuery插件总结(13)定位插件scrollto
  6. struts2文件异步上传
  7. linux-0.11内核 调试教程+GCC源代码
  8. 要将程序集“xxx.dll”标记为系统必备组件,必须对其进行强签名
  9. c语言统计字符数(判断a-z哪个字符出现次数最多)
  10. 设计模式之——Factory(工厂模式)
  11. ACSA Associate -- 01 Introduction To The Course
  12. call是什么?一次说个明白
  13. cf1121F. Compress String(后缀自动机)
  14. 洛谷 P4148 简单题 解题报告
  15. APIO2018酱油记
  16. 使用u盘重装双系统中的乌班图
  17. c语言程序与设计第三版-苏小红--第一轮学习笔记、难点整理
  18. Windows 之 防火墙
  19. 84.Largest Rectangle in histogram---stack
  20. logstash在Windows2008简单配置实例

热门文章

  1. Log4net系列二:Log4net邮件日志以及授权码
  2. this的试题
  3. 【学习笔记】深入理解js原型和闭包(3)——prototype原型
  4. codevs 1316 文化之旅 2012年NOIP全国联赛普及组
  5. Android(java)学习笔记176: 远程服务的应用场景(移动支付案例)
  6. 骑芯供应链(W 笔试)
  7. Python基础2 列表 元祖 字符串 字典 集合 文件操作 -DAY2
  8. struct获取不到值的小错误
  9. B6. Concurrent 内存模型与线程交互
  10. TWaver可视化编辑器的前世今生(一)电信网管编辑器