© 2010 pearson addison-wesley. all rights reserved. addison wesley is an imprint of chapter 6:...

Post on 27-Mar-2015

217 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

© 2010 Pearson Addison-Wesley. All rights reserved.

Addison Wesley is an imprint of

Chapter 6:Modular Programming

Problem Solving & Program Design in C

Sixth Edition

By Jeri R. Hanly &

Elliot B. Koffman

1-2

© 2010 Pearson Addison-Wesley. All rights reserved. 1-2

Figure 6.1 Function separate

1-3

© 2010 Pearson Addison-Wesley. All rights reserved. 1-3

Figure 6.2 Multiple Diagram of Function separate with Results

1-4

© 2010 Pearson Addison-Wesley. All rights reserved. 1-4

Figure 6.3 Program That Calls a Function with Output Arguments

1-5

© 2010 Pearson Addison-Wesley. All rights reserved. 1-5

Figure 6.3 Program That Calls a Function with Output Arguments (cont’d)

1-6

© 2010 Pearson Addison-Wesley. All rights reserved. 1-6

Figure 6.3 Program That Calls a Function with Output Arguments (cont’d)

1-7

© 2010 Pearson Addison-Wesley. All rights reserved. 1-7

Figure 6.4 Parameter Correspondence for separate(value, &sn, &whl, &fr);

1-8

© 2010 Pearson Addison-Wesley. All rights reserved. 1-8

Figure 6.5 Comparison of Direct and Indirect Reference

1-9

© 2010 Pearson Addison-Wesley. All rights reserved. 1-9

Figure 6.6 Program to Sort Three Numbers

1-10

© 2010 Pearson Addison-Wesley. All rights reserved. 1-10

Figure 6.6 Program to Sort Three Numbers (cont’d)

1-11

© 2010 Pearson Addison-Wesley. All rights reserved. 1-11

Figure 6.7 Data Areas After temp = *smp; During Call order(&num1, &num3);

1-12

© 2010 Pearson Addison-Wesley. All rights reserved. 1-12

Figure 6.8 Outline of Program for Studying Scope of Names

1-13

© 2010 Pearson Addison-Wesley. All rights reserved. 1-13

Figure 6.9 Function scan_fraction (incomplete)

1-14

© 2010 Pearson Addison-Wesley. All rights reserved. 1-14

Figure 6.9 Function scan_fraction (incomplete) (cont’d)

1-15

© 2010 Pearson Addison-Wesley. All rights reserved. 1-15

Figure 6.10 Data Areas for scan_fraction and Its Caller

1-16

© 2010 Pearson Addison-Wesley. All rights reserved. 1-16

Figure 6.11 Structure Chart for Common Fraction Problem

1-17

© 2010 Pearson Addison-Wesley. All rights reserved. 1-17

Figure 6.12 Program to Perform Arithmetic Operations on Common Fractions

1-18

© 2010 Pearson Addison-Wesley. All rights reserved. 1-18

Figure 6.12 Program to Perform Arithmetic Operations on Common Fractions (cont’d)

1-19

© 2010 Pearson Addison-Wesley. All rights reserved. 1-19

Figure 6.12 Program to Perform Arithmetic Operations on Common Fractions (cont’d)

1-20

© 2010 Pearson Addison-Wesley. All rights reserved. 1-20

Figure 6.12 Program to Perform Arithmetic Operations on Common Fractions (cont’d)

1-21

© 2010 Pearson Addison-Wesley. All rights reserved. 1-21

Figure 6.12 Program to Perform Arithmetic Operations on Common Fractions (cont’d)

1-22

© 2010 Pearson Addison-Wesley. All rights reserved. 1-22

Figure 6.12 Program to Perform Arithmetic Operations on Common Fractions (cont’d)

1-23

© 2010 Pearson Addison-Wesley. All rights reserved. 1-23

Figure 6.13 Sample Run of a Partially Complete Program Containing Stubs

1-24

© 2010 Pearson Addison-Wesley. All rights reserved. 1-24

Figure 6.14 Stub for Function multiply_fractions

1-25

© 2010 Pearson Addison-Wesley. All rights reserved. 1-25

Figure 6.15 Driver for Function scan_fraction

top related