324 pdfsam Cplusplus Primer Plus 4th Edition

This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks If y...

0 downloads 2 Views 288KB Size
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks

If you can use either an if else if sequence or a switch statement, the usual rule is to use a switch if you have three or more alternatives.

The break and continue Statements The break and continue statements enable a program to skip over parts of the code. You can use the break statement in a switch statement and in any of the loops. It causes program execution to pass to the next statement following the switch or the loop. The

continue statement is used in loops and causes a program to skip the rest of the body of the loop and then start a new loop cycle. (See Figure 6.4.)

Figure 6.4. The break and continue statements.