Question: What is the output of the following program? #include #include using namespace std; int main() { string str1 = Amusement Park; string str2 = Going

What is the output of the following program?

#include

#include

using namespace std;

int main()

{

string str1 = "Amusement Park";

string str2 = "Going to";

string str3 = "the";

string str;

cout << str2 + " "+ str3 + " " + str1 << endl;

cout << str1.length() << endl;

cout << str1.find("P") << endl;

cout << str1.substr(1, 5) << endl;

str = "ABCDEFGHIJK";

cout << str << endl;

cout << str.length() << endl;

str[0] = "a";

str[2] = "d";

cout << str << endl;

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!