Why does the top code work but the bottom one complains about << with the planets map. << planets.find(1)->second
Code:
map<char,int> mymap;
mymap['a']=50;
mymap['b']=100;
mymap['c']=150;
mymap['d']=200;
// print content:
cout << "elements in mymap:" << endl;
cout << "c => " << mymap.find('c')->second << endl;
Code:
map<int,string> planets;
planets[1]="Mercury";
planets[2]="Venus";
planets[3]="Earth";
planets[4]="Mars";
planets[5]="Jupiter";
planets[6]="Saturn";
planets[7]="Uranus";
planets[8]="Neptune";
planets[9]="Pluto";
cout << "p => " << planets.find(1)->second << endl;