HDU 2629 Identity Card
2024-09-07 22:31:30
简单题
给出身份证号 判断住址 和出生年月
熟练字符串的操作
主要是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;
}
}
最新文章
- 关于char的定义语句,正确的有()
- velocity模板入门
- 强大的数据恢复软件--EasyRecovery专业版
- ConfigParser读取记事本、notepad++修改后的配置文件会出现:ConfigParser.MissingSectionHeaderError
- 网站开发常用jQuery插件总结(13)定位插件scrollto
- struts2文件异步上传
- linux-0.11内核 调试教程+GCC源代码
- 要将程序集“xxx.dll”标记为系统必备组件,必须对其进行强签名
- c语言统计字符数(判断a-z哪个字符出现次数最多)
- 设计模式之——Factory(工厂模式)
- ACSA Associate -- 01 Introduction To The Course
- call是什么?一次说个明白
- cf1121F. Compress String(后缀自动机)
- 洛谷 P4148 简单题 解题报告
- APIO2018酱油记
- 使用u盘重装双系统中的乌班图
- c语言程序与设计第三版-苏小红--第一轮学习笔记、难点整理
- Windows 之 防火墙
- 84.Largest Rectangle in histogram---stack
- logstash在Windows2008简单配置实例