CPP
26
strings-insert
Guest on 20th April 2022 02:01:01 AM
#include <iostream>
using namespace std;
#include <string>
int main() {
string sentence="Lawrence will go";
string place=" to the store.";
cout << "The sentence is " << sentence.length() << " characters long." << endl;
cout << sentence << endl;
cout << "Append: " << place << " " << " to: " << sentence << endl;
sentence.append(place);
cout << "The sentence is " << sentence.length() << " characters long." << endl;
cout << sentence << endl;
int pos=sentence.find("go");
sentence.insert(pos,"not ");
cout << "The sentence is " << sentence.length() << " characters long." << endl;
cout << sentence << endl;
}