STL 之multimap
来源:互联网 发布:接吻会传染什么病知乎 编辑:程序博客网 时间:2024/05/01 16:33
#include <map>
#include <iostream>
#include <string>
using namespace std;
typedef multimap<string,string>::value_type CIT;
typedef multimap<string,string>::const_iterator IT;
template<class T1,class T2>
void show(IT&it,multimap<T1,T2>&r)
{
for (it=r.begin();it!=r.end();++it)
{
cout<<it->first<<"\t"<<it->second<<"\n";
}
}
int main()
{
multimap<string,string>phone;
phone.insert(CIT ("朱然","0108225634"));
phone.insert(CIT("朱然","8708532"));
phone.insert(CIT("朱然","13583852314"));
IT ii;
cout<<"遍历并输出所有元素...\n";
show(ii,phone);
cout<<"查找关键字为“朱然”的所有数据:\n";
//ii=phone.find("朱然");
typedef pair<IT, IT> PAIR;
PAIR p=phone.equal_range("朱然");
for(IT i=p.first; i!=p.second; ++i)
{
cout<<i->first<<"\t"<<i->second<<endl;
}
system("pause");
return 0;
}
#include <iostream>
#include <string>
using namespace std;
typedef multimap<string,string>::value_type CIT;
typedef multimap<string,string>::const_iterator IT;
template<class T1,class T2>
void show(IT&it,multimap<T1,T2>&r)
{
for (it=r.begin();it!=r.end();++it)
{
cout<<it->first<<"\t"<<it->second<<"\n";
}
}
int main()
{
multimap<string,string>phone;
phone.insert(CIT ("朱然","0108225634"));
phone.insert(CIT("朱然","8708532"));
phone.insert(CIT("朱然","13583852314"));
IT ii;
cout<<"遍历并输出所有元素...\n";
show(ii,phone);
cout<<"查找关键字为“朱然”的所有数据:\n";
//ii=phone.find("朱然");
typedef pair<IT, IT> PAIR;
PAIR p=phone.equal_range("朱然");
for(IT i=p.first; i!=p.second; ++i)
{
cout<<i->first<<"\t"<<i->second<<endl;
}
system("pause");
return 0;
}
- STL 之multimap
- C++STL之multimap
- STL之multimap简介
- STL之Multimap
- STL 之map,multimap
- STL之 multimap
- STL 之map,multimap
- stl之multimap容器
- stl之multiset,multimap
- STL之map&multimap
- STL之Multimap
- STL之map/multimap
- c++STL之multimap
- stl库之map、multimap
- STL 之 multimap 源码剖析
- C++ STL之 map,multimap
- STL容器之map/multimap
- STL之映射map&multimap
- 完全在用户态实现IPSec VPN
- 【AC自动机详解+入门模板】HDU 2222
- SQL Profile介绍
- http://code.google.com/p/zf-open-source-as-utils/
- 什么是持久化(Persistence)
- STL 之multimap
- SEO研究:尝试利用腾讯微博获取流量
- 单板品牌
- AVL平衡树实现
- 球知名单板品牌介绍
- HASH TABLE
- As3 addEventListener事件监听传递参数
- 办公室人员防止背痛必读
- Agent系列(一) 什么是Agent