Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 4: Selection Structures: if and switch Statements Problem Solving.

Similar presentations


Presentation on theme: "© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 4: Selection Structures: if and switch Statements Problem Solving."— Presentation transcript:

1 © 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 4: Selection Structures: if and switch Statements Problem Solving & Program Design in C Sixth Edition By Jeri R. Hanly & Elliot B. Koffman

2 1-2 © 2010 Pearson Addison-Wesley. All rights reserved. 1-2 Figure 4.1 Evaluation Tree and Step-by- Step Evaluation for !flag || (y + z >= x - z)

3 1-3 © 2010 Pearson Addison-Wesley. All rights reserved. 1-3 Figure 4.2 Range of True Values for min <= x && x <= max

4 1-4 © 2010 Pearson Addison-Wesley. All rights reserved. 1-4 Figure 4.3 Range of True Values for z > x || x > y

5 1-5 © 2010 Pearson Addison-Wesley. All rights reserved. 1-5 Figure 4.4 Flowcharts of if Statements with (a) Two Alternatives and (b) One Alternative

6 1-6 © 2010 Pearson Addison-Wesley. All rights reserved. 1-6 Figure 4.5 if Statement to Order x and y

7 1-7 © 2010 Pearson Addison-Wesley. All rights reserved. 1-7 Figure 4.6 Structure Chart for Water Bill Problem

8 1-8 © 2010 Pearson Addison-Wesley. All rights reserved. 1-8 Figure 4.7 Program for Water Bill Problem

9 1-9 © 2010 Pearson Addison-Wesley. All rights reserved. 1-9 Figure 4.7 Program for Water Bill Problem (cont’d)

10 1-10 © 2010 Pearson Addison-Wesley. All rights reserved. 1-10 Figure 4.7 Program for Water Bill Problem (cont’d)

11 1-11 © 2010 Pearson Addison-Wesley. All rights reserved. 1-11 Figure 4.7 Program for Water Bill Problem (cont’d)

12 1-12 © 2010 Pearson Addison-Wesley. All rights reserved. 1-12 Figure 4.8 Sample Run of Water Bill Program

13 1-13 © 2010 Pearson Addison-Wesley. All rights reserved. 1-13 Figure 4.9 Function comp_use_charge Revised

14 1-14 © 2010 Pearson Addison-Wesley. All rights reserved. 1-14 Figure 4.9 Function comp_use_charge Revised (cont’d)

15 1-15 © 2010 Pearson Addison-Wesley. All rights reserved. 1-15 Figure 4.10 Function comp_tax

16 1-16 © 2010 Pearson Addison-Wesley. All rights reserved. 1-16 Figure 4.10 Function comp_tax (cont’d)

17 1-17 © 2010 Pearson Addison-Wesley. All rights reserved. 1-17 Figure 4.11 Flowchart of Road Sign Decision Process

18 1-18 © 2010 Pearson Addison-Wesley. All rights reserved. 1-18 Figure 4.12 Example of a switch Statement with Type char Case Labels


Download ppt "© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 4: Selection Structures: if and switch Statements Problem Solving."

Similar presentations


Ads by Google