#include <iostream>
#include <map>
#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("朱然","6464684684684"));
	phone.insert(CIT("朱然","64646"));
	phone.insert(CIT("朱然","64646846"));
	IT ii;
	cout<<"遍历whole ele"<<endl;
	show(ii,phone);
	cout<<"find data of the keyword is 朱然"<<endl;
	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;
}

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/xtayaitak/archive/2010/10/27/5968090.aspx

相关文章:

  • 2021-08-29
  • 2022-12-23
  • 2021-06-18
  • 2021-06-04
  • 2022-12-23
  • 2021-06-24
  • 2022-01-21
  • 2021-07-03
猜你喜欢
  • 2021-07-03
  • 2021-04-18
  • 2022-12-23
  • 2021-09-14
  • 2021-06-08
相关资源
相似解决方案