Home » C++ Programming » Strings » Question
  1. What is the output of this program?
    #include <iostream>
    #include <string>
    using namespace std;
    int main ()
    {
    string s ("Interview Mania is being legend");
    string::iterator itr;
    s.erase (s.begin()+ 15, s.end()-7);
    cout << s << endl;
    return 0;
    }
    1. Interview Mania is being legend
    2. Interview Mania legend
    3. Interview Mania
    4. All of above
    5. None of these
Correct Option: B

In this program, We are leaving the first 15 characters and last 7 characters and we are erasing the remaining the characters.



Your comments will be displayed only after manual approval.