|
|
|
|
|
5
Conditions, Logical Expressions, and Selection Control Structures |
|
|
|
| |
 |
|
|
|
|
Flow of Control |
|
|
|
| |
 |
|
|
|
|
Selection |
|
|
|
| |
 |
|
|
|
|
Conditions and Logical Expressions |
|
|
|
| |
 |
|
|
|
|
Logical Expressions |
|
|
|
| |
 |
|
|
|
|
Boolean Data |
|
|
|
| |
 |
|
|
|
|
Relational Operators |
|
|
|
| |
 |
|
|
|
|
Logical Operators |
|
|
|
| |
 |
|
|
|
|
Short-Circuit Evaluation |
|
|
|
| |
 |
|
|
|
|
Precedence of Operators |
|
|
|
| |
 |
|
|
|
|
May We Introduce: George Boole |
|
|
|
| |
 |
|
|
|
|
Software Engineering Tip: Changing English Statements into Logical Expressions |
|
|
|
| |
 |
|
|
|
|
Relational Operators with Floating Point Types |
|
|
|
| |
 |
|
|
|
|
The If Statement |
|
|
|
| |
 |
|
|
|
|
The If-Then-Else Form |
|
|
|
| |
 |
|
|
|
|
Blocks (Compound Statements) |
|
|
|
| |
 |
|
|
|
|
Matters of Style: Braces and Blocks |
|
|
|
| |
 |
|
|
|
|
The If-Then Form |
|
|
|
| |
 |
|
|
|
|
A Common Mistake |
|
|
|
| |
 |
|
|
|
|
Nested If Statements |
|
|
|
| |
 |
|
|
|
|
The Dangling Else |
|
|
|
| |
 |
|
|
|
|
Testing the State of an I/O Stream |
|
|
|
| |
 |
|
|
|
|
Problem-Solving Case Study: An Electronic Activity Director |
|
|
|
| |
 |
|
|
|
|
Problem-Solving Case Study: Warning Notices |
|
|
|
| |
 |
|
|
|
|
Problem-Solving Case Study: The Lumberyard |
|
|
|
| |
 |
|
|
|
|
Testing and Debugging |
|
|
|
| |
 |
|
|
|
|
The Problem-Solving Phase: The Algorithm Walk-Through |
|
|
|
| |
 |
|
|
|
|
The Implementation Phase |
|
|
|
| |
 |
|
|
|
|
Code Walk-Through |
|
|
|
| |
 |
|
|
|
|
Execution Trace |
|
|
|
| |
 |
|
|
|
|
Testing Selection Control Structures |
|
|
|
| |