Flowcharts - HP -11C Owner's Handbook Manual

Hide thumbs Also See for HP-11C:
Table of Contents

Advertisement

208
Section 11: Pragramming Techniques
5.
Store this result in Re.
If the value in Rg is positive or zero add the numbers in Ry
and Rg together and display the (real) result.
7.
Ifthe value in Rp is less than zero display the contents of Ry
and R¢ separately (the complex root).
8.
Change the sign of the value in Rc and repeat the previous
two steps.
In this refinement, we realize the importance of using registers to
store intermediate results. Also, the operations are better defined
and consideration is given to the actual output.
The degree of refinement of the final algorithm is up to personal
preference, but the more refined the algorithm the less likely the
program
itself will have to be later modified in order to work
properly. Our final algorithm takes us to a satisfactory level.
Using the hypothetical registers R4, Rg, Rc, Rp and Rg do the
following:
1.
Store ain Ry, negative bin Rg and cin Ro.
2.
Divide Rg by twice R, and store the result in Rp.
3.
Subtract four Ry times Rc from Rg squared and store the
result in Rp.
4.
Find the square root of the absolute value of Ry and divide it
by twice R4. Store this value in Ry.
5.
If Ry is positive or zero add Rg to Rp and display the result.
6.
IfRyis negative display Rg and Rp separately.
7.
Change the sign of Rp and repeat the previous two steps.
This algorithm takes into account the initial storage of data and
reuses Rp, thereby reducing the total number of storage registers
needed.
Flowcharts
A useful way of visualizing your developing algorithm is to use a
"flowchart". A flowchart is a diagram of the flow of the algorithm,
giving form to the train of thought you are developing. An example
that uses our developed algorithm is:
~~
ii
é
tL.
[Store a in Ra, -b in Ri
P Store Re/2Rain Ro. |
Section 11: Programming Techniques
andc in Re.
Le
y
r
| Store Re' — 4X
Ra XRe |
1
|
at
-
£
Display Re.
Display Ro.
display the result.
iene
Change the |
sign of Re.
—-
beendis-
>
played?
/ Add Reto Rp and
209

Advertisement

Table of Contents
loading

Table of Contents