#include #include #include using namespace std; int main() { typedef map myMap; // alias for convenience myMap::iterator pos; myMap m; // a map from strings to doubles m["dog"]; // puts pair <"dog",0.0> into m m["bird"]=5.2; // puts pair <"bird",5.2> into m pos = m.find("cat"); // returns m.end() for not found cout<< (pos==m.end())<< endl;// prints 1 (true) pos = m.find("bird"); // pos points to <"bird",5.2> if (pos!=m.end()) { cout<< pos->first<< endl; // prints "bird" cout<< pos->second<< endl; // prints 5.2; } } }