Calculate and output the area of a triangle using dimensions provided by the user.
This problem is more complex than the first Triangle-Area problem, because we have to get information from the user. To accomplish the task, we need to let the user know what the program does and we have to request that the user input the data. Then we can carry on just as we did in the previous problem.
|
|
|
Step 1 can be broken down into many individual steps. Here we will use two: The flowchart segment in Diagram B at the right shows the two steps as being included inside Step 1. |
|
|
Step 2 is more complicated: we need to get two values from the user - the one for the base and the one for the height. This is shown in Diagram C by drawing two process boxes inside box 2. |
|
|
Inside each one of these boxes, the program has to prompt the user (tell the user to type in a value) and then read in what is typed. Diagram D illustrates how each of these boxes would be redrawn. |
|
|
The resulting more specific flowchart is given in Diagram E and the corresponding, detailed pseudocode is found below. 1. Introduction: |
|