Wednesday, 8 July 2015

How to create a visual calculator in C

 
The visual calculator was written to be used for quick calculations of the variety that would
ordinarily be done with a hand held calculator. There is no allowance for programming loops,
or indirect variables, or any of the other facilities of a modern programming language. There
are no complications either, and this program should not require more than a few minutes for
the experienced computer user to learn to use, and only slightly longer for the person inexperienced
with computers.
It is suggested that you slowly run through the tutorial first, performing the operations suggested,
then read the following comments for a description of the visual calculator. This program is
intended to be much more comprehensive than the little on-screen calculators that have become
popular, but it is not memory resident. Due to the expected future popularity of such programs
as "Windows", this program can be as convenient as the present memory resident programs.
15.1 The Visual Calculator Tutorial
1. Copy all files to another working diskette with your operating system or to a single
directory on your hard disk.
2. Type VC <return> You will get the beginning screen containing the variable boxes
and the help box at the top. The center of the screen contains the transcript box, and
at the bottom you will find the Input box.
3. Type A = 123.45 <return> You will find that the value is displayed in the top box
and the value will also be displayed at the left of the input equation in the transcript
box.
4. Type B = SQRT(A) <return> You will find the square root of A displayed in both
places next to the variable B. You may have noticed that the system doesn’t care if
you use upper or lower case, it forces it to upper case. You now have defined some
values for the variables A and B.
5. Type D = 1.23*SIN(SQRT(1.2345 + B*B/A)) <return> Spaces between variables
don’t matter and you can put them in where you desire to make it look nice. If you
get an error message, simply use the left and right cursor keys along with the delete
key to fix up the error and hit the return again. You don’t even have to be at the end
of the line to hit the return.
6. Hit the F6 key then <return> The F6 requests a file to be read in and if you don’t
specify a filename, it reads in the file named "HELP". This would be a good place
to store a list of your other files in the same manner as this file.
7. Hit the F6 key then type AMORT <return> This reads in the file named "AMORT"
and calculates each line as it reads it in. Notice that it also changed the names of the
variables that it uses to make them more meaningful to you.
8. Type PRINC = 30000 <return> This changes the amount of the loan. We would like
to recalculate the payment which we will in the next few steps.
9. Move the arrow up to the line that starts "PMNT=..." by using the up and down arrow
keys. When the arrow is point- ing at the line in question,...
10. Hit the F9 key. This moves the line pointed at, by the little arrow, into the input box
where it can be modified or used again as is.
15

No comments:

Post a Comment