Home » C++ Programming » Strings » Question
  1. What is the output of this program?
    #include <iostream>
    #include <string>
    using namespace std;
    int main ()
    {
    string s="Manjesh Ojha founded the Interview Mania";
    string s2 = s.substr (0, 12);
    unsigned pos = s.find("the");
    string s3 = s.substr (pos);
    cout << s2 << ' ' << s3 << '\n';
    return 0;
    }
    1. Manjesh Ojha founded the Interview Mania
    2. Manjesh Ojha
    3. Interview Mania
    4. founded
    5. Manjesh Ojha the Interview Mania
Correct Option: E

In this program, We are finding the substring of the string by using the substr function.



Your comments will be displayed only after manual approval.