Chapter 10
Flow of Control
Selection: ‘if’ construct
‘if’ construct
Compound-statement Action
Flags
Naming a Flag
Nested ‘if’ statement
Short-circuit evaluation
Complementing a Condition
DeMorgan’s Theorem
Common Mistakes
‘if-else’ construct
Style
Removing common statements
Logical assignment for Flags
Nested ‘if-else’ statements
Conditional Operator (?:)
‘switch’ construct
Repetition Structure
‘while’ construct
Counter-control repetition
Sentinel-control repetition
‘do-while’ construct
Flag-controlled loops
‘for’ construct
‘break’ statement
‘continue’ statement
Nested loops & combined structures
Homework
Email: tantc@comp.nus.edu.sg
Home Page: http://www.comp.nus.edu.sg/~tantc