mymap.erase (it); // erasing by iteratormymap.erase ('c'); // erasing by keymymap.erase ( it, mymap.end() ); // erasing by range
foo.swap(bar);
pair <string,double> product1 ("tomatoes",3.25);pair <string,double> product2;pair <string,double> product3;product2.first = "lightbulbs"; // type of first is stringproduct2.second = 0.99; // type of second is doubleproduct3 = make_pair ("shoes",20.0);
#include<iostream>#include<string>#include<map>#include<algorithm>#include<cmath>using namespace std;int main(){int xie;int m,n;double k;string s;int a;map<string,int> human;map<string,int>::iterator it;const double eps=1e-7;scanf("%d%d%lf",&m,&n,&k);while(m--){scanf("%s%d",&s,&a);xie=(int)(a*k+eps);if(xie>=100) human[s]=a;}while(n--){scanf("%s",&s);if(human[s]<100) human[s]=0; //insert} //sort(human.begin(),human.end());printf("%d",(int)map.size());for(it=human.begin();it!=human.end();it++) //<m.end size_t iprintf("%s%d",*it.first,*it.second);return 0;}