Question: Suppose we have the following two strings: string a = Frodo; string b = Sam; Write the result of the following statements. Use the original

Suppose we have the following two strings:
string a = "Frodo";
string b = "Sam";
Write the result of the following statements. Use the original a and b for each problem.
1.) cout << a.substr(1,3);
2.) cout << b + a.substr(3,2);
3.) b.insert(2, a);
cout << b;
4.) a.erase(3,2);
cout << a + b;
5.) string c = a+b;
cout << setw(10)<< a;
cout << setw(10)<< c;
6.) a.erase( a.find(0,"o"),2);
cout << a;
7.) Write a single line of code that deletes the first letter "Q" in a given string s

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 Databases Questions!