Welcome Guest
( Log In | Register )
The time is now 11:31 pm
You last visited January 17, 2017, 10:48 pm
All times shown are
Eastern Time (GMT-5:00)

The 4 functions calculator is finished and download link for the Exe file posted.

Published:

Last Edited: April 17, 2011, 1:54 pm

It was easy to make, a little later I will see if I can shorten out the code as it is too long now, now it has all 4 functions working.

2 PRINT "Calculator."
3 C = C
4 PRINT "Type: E ( E = Exit) or + or - or X or /"
8 INPUT "Type one of the 5 options and press Enter ";X$
12 IF X$ = "E" THEN 500
30 IF X$ = "+" THEN 50
31 IF X$ = "-" THEN 60
32 IF X$ = "X" THEN 70
33 IF X$ = "/" THEN 80
35 GOTO 4
50 PRINT "Addition": GOTO 100
60 PRINT "Substraction": GOTO 200
70 PRINT "Multiplication": GOTO 300
80 PRINT "Division" : GOTO 400
90 REM Addition Routine
100 PRINT "Right now you have:": PRINT C
101 PRINT "Type a number"
102 PRINT "And press the Enter key"
104 INPUT "To use other function or to Exit enter 0 (Zero)"; A
106 IF A = 0 THEN 4
107 C = C + A
114 GOTO 100
200 REM Substraction Routine
201 PRINT "Right now you have:": PRINT C
202 PRINT "Type a number"
203 PRINT "And press the Enter key"
204 INPUT "To use other function enter 0 (Zero)"; A
206 IF A = 0 THEN 4
210 C = C - A
211 GOTO 201
290 REM Multiplication Routine
300 PRINT "Right now you have:": PRINT C
301 PRINT "Type a number"
302 PRINT "And press the Enter key"
304 INPUT "To use other function or to Exit enter 0 (Zero)"; A
306 IF A = 0 THEN 4
307 C = C * A
314 GOTO 300
390 REM Division Routine
400 PRINT "Right now you have:": PRINT C
401 PRINT "Type a number"
402 PRINT "And press the Enter key"
404 INPUT "To use other function or to Exit enter 0 (Zero)"; A
406 IF A = 0 THEN 4
407 C = C / A
414 GOTO 400
500 END

----------

See how long that code is?

I compacted it:

1 PRINT "Calculator."
2 C = C
3 PRINT "Type: E ( E = Exit) or + or - or X or /"
4 INPUT "Type one of the 5 options and press Enter ";X$
5 IF X$ = "E" THEN 26
6 PRINT "Right now you have:": PRINT C
7 PRINT "Type a number And press the Enter key"
8 INPUT "To use other function or to Exit enter 0 (Zero)"; A
9 IF A = 0 THEN 3
10 IF X$ = "+" THEN 14
11 IF X$ = "-" THEN 17
12 IF X$ = "X" THEN 20
13 IF X$ = "/" THEN 23
14 C = C + A
15 PRINT "Addition"
16 GOTO 6
17 C = C - A
18 PRINT "Substraction"
19 GOTO 6
20 C = C * A
21 PRINT "Multiplication"
22 GOTO 6
23 C = C / A
24 PRINT "Division"
25 GOTO 6
26 END

--------

I tried to make it smaller than this, but could not so far:

1 PRINT "Calculator.":C = C
3 PRINT "Type: E ( E = Exit) or + or - or X or /"
4 INPUT "Type one of the 5 options and press Enter ";X$
5 IF X$ = "E" THEN 26
6 PRINT "Right now you have:": PRINT C
7 PRINT "Type a number And press the Enter key"
8 INPUT "To use other function or to Exit enter 0 (Zero)"; A
9 IF A = 0 THEN 3
10 IF X$ = "+" THEN 14
11 IF X$ = "-" THEN 17
12 IF X$ = "X" THEN 20
13 IF X$ = "/" THEN 23
14 C = C + A:PRINT "Addition":GOTO 6
17 C = C - A:PRINT "Substraction":GOTO 6
20 C = C * A:PRINT "Multiplication":GOTO 6
23 C = C / A:PRINT "Division":GOTO 6
26 END

--------------

Download link of the finished calculator's Exe file:

Download link good for 7 days only!

http://wikisend.com/download/601206/Fernando'sCalculator1.00.exe

-----------

As seen, even simple old basic with line numbers and all has its uses, RJOh uses it also.

It is not so much the programming language used, but how it is used that matters the most, well, up to a point, old programming languages have some limitations, it also depends on the compiler if you compile it.

Maybe I do have a mind for programming and I still know next to nothing about programming and also about Math.

Entry #339

Comments

This Blog entry currently has no comments.

You must be a Lottery Post member to post comments to a Blog.

Register for a FREE membership, or if you're already a member please Log In.