adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <map>
    using namespace std;
    int main ()
    {
        try {
            map<char, int> mymap;
            map<char, int> :: iterator it;
            mymap['a'] = 50;
            mymap['b'] = 100;
            mymap['c'] = 150;
            mymap['d'] = 200;
            it = mymap.find('b');
            mymap.erase (it);
            mymap.erase (mymap.find('d'));
            cout << mymap.find('a') -> second << '\n';
        }
        catch (...) 
        {
            cout << "Unknown exception: " << endl;
        }
        return 0;
    }

a.

50

b.

100

c.

150

d.

Exception

Answer: (a).50

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?