Examveda

What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
    string str ("steve jobs is legend");
    string::iterator it;
    str.erase (str.begin()+ 5, str.end()-7);
    cout << str << endl;      
    return 0;
}

A. jobs is

B. steve legend

C. steve

D. steve jobs is

Answer: Option B


Join The Discussion

Related Questions on Classes and Objects in C plus plus