This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Chapter 7.2 Multiway Branches • Branching Mechanism- chooses one from a number of alternative actions o If-else o If o While o Do-while • Make sure you use braces to specify where one if statement ends and another begins • Can use else if instead of indenting on another line and simplifying the code. • Use switch statement to execute one of a number of cases • Break statement to end the switch • Default section to use any other possible answers • Use functions to simplify code • Can have blocks with variable declarations local to the compound statement...
View Full Document
- Fall '08
- Logic, Articles with example C code