Docsity

C++ Programming: Understanding the Use of 'break' and 'continue' Statements, Study Guides, Projects, Research of Design

Partial preview of the text

Download C++ Programming: Understanding the Use of 'break' and 'continue' Statements and more Study Guides, Projects, Research Design in PDF only on Docsity!

C++ Programming: Program Design 1

break and continue Statements

  • break and continue alter the flow of control
  • Should be used sparingly
    • Excessive numbers of exit conditions from a loop are difficult to keep track of

C++ Programming: Program Design 2

break

  • break is used for two purposes:
    • To exit early from a loop
      • Can eliminate the use of certain (flag) variables
    • To skip the remainder of the switch structure
  • After the break statement executes, the program continues with the first statement after the loop or switch