go to previous page   go to home page   go to next page

Answer:

Sometimes. But you should write the structured version first. Keep it, so that when the speedy version turns out to be buggy you have something that works.


Top-down Design

One-block Flowchart

The absolute value problem (three pages back) is an example of Top-down structured design. When using this design method you start with just one program block, and then replace that block with one of the structures sequence, alternation, or iteration. You then refine the new flowchart by replacing one of its blocks with one of the same structures. Continue replacing blocks with structures until the flowchart has enough detail to work as a design for a program.

For example, say that you want to design a program that adds up integers entered by the user. The initial design might look like the picture at right.

(Actually, you would probably do this step in your mind and not actually draw the flowchart.)


QUESTION 18:

Think about how the flowchart could be refined to show more detail. Replace the code block with just one of the three structures.