(Removing break and continue ) A criticism of the break statement and the continue statement is that each isunstructured. Actually, these statements can always be replaced by structured statements, although doing so can beawkward. Describe in general how you’d remove any break statement from a loop in a program and replace it with some structured equivalent. [Hint: The break statement exits a loop from the body of the loop. The other way to exit is by failing the loop-continuation test. Consider using in the loop-continuation test a second test that indicates “early exit because of a ‘break’ condition.”] Use the technique you develop here to remove thebreak statement from the application.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.1: Selection Criteria
Problem 2E
icon
Related questions
Question
(Removing break and continue ) A criticism of the break statement and the continue statement is that each is
unstructured. Actually, these statements can always be replaced by structured statements, although doing so can be
awkward. Describe in general how you’d remove any break statement from a loop in a program and replace it with some structured equivalent. [Hint: The break statement exits a loop from the body of the loop. The other way to exit is by failing the loop-continuation test. Consider using in the loop-continuation test a second test that indicates “early exit because of a ‘break’ condition.”] Use the technique you develop here to remove thebreak statement from the application.
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer