#include <iostream>
#include <string>
using namespace std;
int main()
{
string stringObject1("stringObject1");
string stringObject2("stringObject2");
cout << "Initial strings:\n";
cout << "stringObject1: " << stringObject1 << endl;
cout << "stringObject2: " << stringObject2 << "\n\n";
cout << "Insert stringObject2 into stringObject1:\n";
stringObject1.insert(6, stringObject2);
cout << stringObject1 << "\n\n";
cout << "Remove 9 characters from stringObject1:\n";
stringObject1.erase(6, 9);
cout << stringObject1 <<"\n\n";
cout << "Replace 8 characters in stringObject1 with stringObject2:\n";
stringObject1.replace(7, 8, stringObject2);
cout << stringObject1 << endl;
return 0;
}
|