ExamVeda
Login
Home
C plus plus miscellaneous
?

What will be the output of the following C++ code?
#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;
}

Answer & Solution
Correct Answer: Option A
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.