Question: Find and fix any errors in the following code fragment. The comments indicate what should have happened before, during, and by the end of the

Find and fix any errors in the following code fragment. The comments indicate what should have happened before, during, and by the end of the fragment were things all well and good. (You may assume that things are perfectly set up before the fragment and continue fine there-after.)
// line is a string read with getline and so may contain spaces
while (line.find("")== npos)// found a double space
{
line.erase(line.find("")); // erase one of them
}
// line now only has single spaces

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!