#include <map> #include <iostream> using namespace std;
void main()
{
map <string, int> dic; dic.insert(pair<string, int>("a", 5)); dic.insert(pair<string, int>("b", 2)); dic.insert(pair<string, int>("a", 3)); //allow duplicate key dic.insert(pair<string, int>("c", 7)); dic.insert(pair<string, int>("d", 9)); dic.insert(pair<string, int>("e", 20)); dic["c"] = 8; map<string,int>::iterator finder;; finder=dic.find("c"); if(finder==dic.end()) cout<<"we do not find 112"<<endl; else { cout<<"total:"<<dic.size()<<endl; cout<<"wo find c:"<<dic["c"]<<endl; dic.erase(finder); //delete cout<<"total:"<<dic.size()<<endl; } int c =0; c = getchar();
}