输入孩子的姓名, 用map存储,&…
2014-07-17 16:36
225 查看
int main (int argc, char* argv[])
{
std::ios::sync_with_stdio (false);
string
firstName, lastName;
multimap<
string, vector< string>>kidsNames;
while (cin
>> firstName >> lastName) {
vectorlastNames;
lastNames.push_back (lastName);
kidsNames.insert({ firstName, lastNames});
}
cout
<< "There are the names:" << endl;
for (auto
map_it = kidsNames.cbegin (); map_it != kidsNames.cend ();
++map_it)
for (auto vec_it = map_it->second.cbegin ();
vec_it != map_it->second.cend (); ++vec_it)
cout << map_it->first << *vec_it
<< endl;
return
0;
}
{
std::ios::sync_with_stdio (false);
string
firstName, lastName;
multimap<
string, vector< string>>kidsNames;
while (cin
>> firstName >> lastName) {
vectorlastNames;
lastNames.push_back (lastName);
kidsNames.insert({ firstName, lastNames});
}
cout
<< "There are the names:" << endl;
for (auto
map_it = kidsNames.cbegin (); map_it != kidsNames.cend ();
++map_it)
for (auto vec_it = map_it->second.cbegin ();
vec_it != map_it->second.cend (); ++vec_it)
cout << map_it->first << *vec_it
<< endl;
return
0;
}
相关文章推荐
- 输入孩子的姓名, 用map存储,&…
- T5.0.18 输入html 空格 &nbsp;
- C++_学生资料管理简单举例·输入学号,姓名,以及查找
- c/c++&nbsp;缓冲输入和非缓冲输入
- Linux输入子系统&nbsp;input_dev&nbsp;概述
- [Python Tip]判断输入是否被…
- 替换输入域中&nbsp方法
- Html5本地存储之Web SQL&nbsp…
- Java Map试用方法
- C# WINFORM 某些控件实现联想输入…
- Nand&nbsp;Flash存储结构及控制方法(K9F…
- shell 脚本中关于用户输入参…
- 输入子系统读书笔记&nbsp;&nbsp;input
- Android中List与Map<String,Object>及SimpleAdapter用来存储数据并展示出来的联合用法
- 关联容器:set multiset map multi…
- 黑马程序员之WinForm编程基础学习笔记:在多行文本框中输入多行"姓名=成绩"格式的数据,要求输出成绩最高的学生的姓名和成绩。
- java:Ibatis&nbsp;&nbsp;parameterMap(…
- Matlab&nbsp;数据的输入和输出
- File&nbsp;Save&nbsp;type&nbsp;归档形式存储文件…
- Nand&nbsp;Flash存储结构及控制方法(K9F…