Chapter 5: Decision and Loop Statements


Download CD Content

Overview

In this chapter, you will learn how to:

  • Make decisions by using the if statement

  • Make multiway decisions by using the switch statement

  • Perform loops by using the while, for, and do-while statements

  • Perform unconditional jumps in a loop by using the break and continue statements

All high-level languages provide keywords that enable you to make decisions and perform loops. C++ is no exception. C++ provides the if statement and the switch statement for making decisions, and C++ provides the while, for, and do- while statements for performing loops. In addition, C++ provides the break statement to exit a loop immediately and the continue statement to return to the start of the loop for the next iteration.

In this chapter, you will see how to use these statements to control the flow of execution through a Microsoft Visual C++ application.




Microsoft Visual C++  .NET(c) Step by Step
Microsoft Visual C++ .NET(c) Step by Step
ISBN: 735615675
EAN: N/A
Year: 2003
Pages: 208

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net