Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include <iostream>
    #include <map>
    using namespace std;
    int main ()
    {
    try {
    map<char, int> Data;
    map<char, int> :: iterator Iter;
    Data['P'] = 55;
    Data['Q'] = 105;
    Data['R'] = 155;
    Data['S'] = 205;
    Iter = Data.find('Q');
    Data.erase (Iter);
    Data.erase (Data.find('S'));
    cout << Data.find('P') -> second << '\n';
    }
    catch (...)
    {
    cout << "Unknown exception: " << endl;
    }
    return 0;
    }
    1. 205
    2. 155
    3. 105
    4. 55
    5. Compilation Error
Correct Option: D

In this program ,We are finding the element a and printing it.



Your comments will be displayed only after manual approval.