Home » C++ Programming » Strings » Question
  1. What is the output of this program?
    #include <iostream>
    #include <string>
    using namespace std;
    int main ()
    {
    string s1;
    string s2="Manjesh Ojha";
    string s3="He founded Interview Mania";
    s1.append(s2);
    s1.append(s3, 2, 4);
    s1.append(s3.begin() + 6, s3.end());
    s1.append(5, 0x2E);
    cout << s1 << '\n';
    return 0;
    }
    1. Manjesh Ojha
    2. He founded Interview Mania
    3. Manjesh Ojha founded Interview Mania.....
    4. Compilation Error
    5. None of these
Correct Option: C

In this program, We are characters to the string, So the output will as follows.



Your comments will be displayed only after manual approval.