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 thereafter.
line is a string read with getline and so may contain spaces
while linefind npos found a double space
line.eraselinefind; 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
