Question: USING C++ Get a copy of the stringF.cpp file by: -------------------------------------------- copy of the stringF.cpp #include #include using namespace std; int main() { string oldSentence;

USING C++

Get a copy of the stringF.cpp file by:

--------------------------------------------

copy of the stringF.cpp

#include  #include  using namespace std; int main() { string oldSentence; oldSentence = "The quick brown dog jumped WAY over the lazy cat."; // ADD CODE HERE: display oldSentence // ADD CODE HERE: display the length of oldSentence // Do not make any change to the following code. // Just read and understand this program. // To create a new sentence without "WAY ": // First, find the positition where WAY appears int i = oldSentence.find("WAY "); cout << "i is " << i << endl; // Second, get the characters up to "WAY " string newSentence = oldSentence.substr(0, i); cout << "Modified sentence: " << newSentence << endl; // Finally, append the characters after "WAY " // "WAY " is 4 characters long, so start 4 characters after i. // Leave out the second argument to get the rest of the line. newSentence = oldSentence.substr(0, i) + oldSentence.substr(i + 4); //OR: newSentence += oldSentence.substr(i + 4); cout << "Completed sentence: " << newSentence << endl; return 0; } 

-------------------------------------------------------------------------------------------------------------------------------------

Entering the cp command: cp /net/data/ftp/pub/class/110/ftp/cpp/stringF.cpp stringF.cpp

or, using your mouse to copy and paste the program into Pico,

or, using the Hercules command-line ftp program to copy this file from the CS Department's anonymous ftp site.

The path: pub/class/110/ftp/cpp/ The file: stringF.cpp 

The purpose of the program is to practice the length(), find() and substr() string functions.

-Show your lab instructor the program output.

-Add 2 lines of code as indicated in the comments

-Compile and run this C++ program.

Entering the cp command: cp /net/data/ftp/pub/class/110/ftp/cpp/stringF.cpp stringF.cpp

or, using your mouse to copy and paste the program into Pico,

or, using the Hercules command-line ftp program to copy this file from the CS Department's anonymous ftp site.

The path: pub/class/110/ftp/cpp/ The file: stringF.cpp 

The purpose of the program is to practice the length(), find() and substr() string functions.

Show your lab instructor the program output.

Add 2 lines of code as indicated in the comments

Compile and run this C++ program.

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!