www.gibmonks.com

Main Page




Previous Page
Next Page

[Page 185]

Chapter 5. Control Statements: Part 2

Not everything that can be counted counts, and not every thing that counts can be counted.

Albert Einstein

Who can control his fate?

William Shakespeare

The used key is always bright.

Benjamin Franklin

Intelligence ... is the faculty of making artificial objects, especially tools to make tools.

Henri Bergson

Every advantage in the past is judged in the light of the final issue.

Demosthenes

OBJECTIVES

In this chapter you will learn:

  • The essentials of counter-controlled repetition.

  • To use the for and do...while repetition statements to execute statements in a program repeatedly.

  • To understand multiple selection using the switch selection statement.

  • To use the break and continue program control statements to alter the flow of control.

  • To use the logical operators to form complex conditional expressions in control statements.

  • To avoid the consequences of confusing the equality and assignment operators.


[Page 186]

Outline

5.1 Introduction

5.2 Essentials of Counter-Controlled Repetition

5.3 for Repetition Statement

5.4 Examples Using the for Statement

5.5 do...while Repetition Statement

5.6 switch Multiple-Selection Statement

5.7 break and continue Statements

5.8 Logical Operators

5.9 Confusing Equality (==) and Assignment (=) Operators

5.10 Structured Programming Summary

5.11 (Optional) Software Engineering Case Study: Identifying Objects' States and Activities in the ATM System

5.12 Wrap-Up

Summary

Terminology

Self-Review Exercises

Answers to Self-Review Exercises

Exercises


Previous Page
Next Page