1// map::find
2#include <iostream>
3#include <map>
4
5int main ()
6{
7 std::map<char,int> mymap;
8 std::map<char,int>::iterator it;
9
10 mymap['a']=50;
11 mymap['b']=100;
12 mymap['c']=150;
13 mymap['d']=200;
14
15 it = mymap.find('b');
16 if (it != mymap.end())
17 mymap.erase (it);
18
19 // print content:
20 std::cout << "elements in mymap:" << '\n';
21 std::cout << "a => " << mymap.find('a')->second << '\n';
22 std::cout << "c => " << mymap.find('c')->second << '\n';
23 std::cout << "d => " << mymap.find('d')->second << '\n';
24
25 return 0;
26}