The Math Test

3 replies [Last post]
italianapple's picture
Offline
Joined: Jan 28 2007
Posts: 94

My second basic program for the Apple I ....

it's a simple math test for kids, ....well, i give it go too Smile

IA.

The code:

1 DIM A$(1)
2 DIM B$(1)

4 PRINT ""
5 PRINT ""

9 TAB 11: PRINT " THE MATH TEST"
20 TAB 11: PRINT " CREATED BY"
30 TAB 11: PRINT " ITALIAN APPLE"
40 TAB 11: PRINT "FOR THE APPLE I"
45 PRINT ""
60 PRINT ""
70 TAB 11: PRINT "1 - ADDITION"
80 TAB 11: PRINT "2 - SUBTRACTION"
101 TAB 11: PRINT "3 - EXIT"
102 PRINT ""

103 TAB 11: INPUT "INPUT YOUR CHOICE",N
120 IF N=1 THEN GOTO 160
130 IF N=2 THEN GOTO 450
151 IF N=3 THEN PRINT "BYE BYE" : END
152 IF N<>1 THEN GOTO 103
153 IF N<>2 THEN GOTO 103
154 IF N<>3 THEN GOTO 103

160 TAB 11: PRINT "THE ADDITION TEST": PRINT ""
170 A= RND (100)
180 B= RND (100)
190 C=A+B
200 IF B>A THEN GOTO 310
210 TAB 11: PRINT A;"+"
220 TAB 11: PRINT B
230 TAB 11: PRINT "---"
240 TAB 11: PRINT ""
250 TAB 11: INPUT "WHAT'S THE RESULT ",R
260 IF R<>C THEN GOSUB 305
270 TAB 11: PRINT "PERFECT !"
280 TAB 11: INPUT "ANOTHER TRY (Y/N) ",A$
290 IF A$="Y" THEN GOTO 160
300 GOTO 70

305 TAB 11: INPUT "WRONG, TRY AGAIN (Y/N) ",B$: PRINT ""
306 IF B$="Y" THEN GOTO 210
307 TAB 11: PRINT "THE RESULT IS ";C;
308 GOTO 4
309 RETURN

310 TAB 11: PRINT B;"+"
320 TAB 11: PRINT A
330 TAB 11: PRINT "---"
340 TAB 11: PRINT ""
350 TAB 11: INPUT "WHAT'S THE RESULT ",R
360 IF R<>C THEN GOSUB 405
370 TAB 11: PRINT "PERFECT !"
380 TAB 11: INPUT "ANOTHER TRY (Y/N) ",A$
390 IF A$="Y" THEN GOTO 160
400 GOTO 70

405 TAB 11: INPUT "WRONG, TRY AGAIN (Y/N) ",B$: PRINT ""
406 IF B$="Y" THEN GOTO 210
407 TAB 11: PRINT "THE RESULT IS " ;C;
408 GOTO 4
409 RETURN

450 TAB 11: PRINT "THE SUBTRACTION TEST"
451 PRINT ""
460 A= RND (100)
480 B= RND (100)
490 C=A-B
491 K=B-A
500 IF B>A THEN GOTO 710
510 TAB 11: PRINT A;"-"
520 TAB 11: PRINT B
530 TAB 11: PRINT "---"
540 TAB 11: PRINT ""
550 TAB 11: INPUT "WHAT'S THE RESULT ",R
560 IF R<>C THEN GOSUB 605
570 TAB 11: PRINT "PERFECT !"
580 TAB 11: INPUT "ANOTHER TRY (Y/N) ",A$
590 IF A$="Y" THEN GOTO 450
600 GOTO 70

605 TAB 11: PRINT "WRONG, TRY AGAIN (Y/N) ", B$: PRINT ""
606 IF B$ = "Y" THEN GOTO 510
607 TAB 11: PRINT "THE RESULT IS ";C;
608 GOTO 4
609 RETURN

710 TAB 11: PRINT B;"-"
720 TAB 11: PRINT A
730 TAB 11: PRINT "---"
740 PRINT ""
750 TAB 11: INPUT "WHAT'S THE RESULT ",R
760 IF R<>K THEN GOSUB 805
770 TAB 11: PRINT "PERFECT !"
780 TAB 11: INPUT "ANOTHER TRY (Y/N) ",A$
790 IF A$="Y" THEN GOTO 450
800 GOTO 70

805 TAB 11: PRINT "WRONG, TRY AGAIN (Y/N) ", B$: PRINT ""
806 IF B$ = "Y" THEN GOTO 710
807 TAB 11: PRINT "THE RESULT IS ";C;
808 GOTO 4
809 RETURN

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
italianapple's picture
Offline
Joined: Jan 28 2007
Posts: 94
Dam!!!!

I don't know why when i cut & past, it loses some pieces of the code ...

bug fix:

152 IF N#1 THEN GOTO 103
153 IF N#2 THEN GOTO 103
154 IF N#3 THEN GOTO 103

260 IF R#C THEN GOSUB 305
360 IF R#C THEN GOSUB 405

560 IF R#C THEN GOSUB 605
760 IF R#K THEN GOSUB 805

Sorry, next time i will check the code before i'll confirm the post-
i run the code on the Apple I before i post it ....

edit:

again, the HTML code does not let me post "minor" or "greater" values !!!!!!!!!

Franz Achatz give me a quick tip: use the "#", it gives you the same result.

Offline
Joined: May 24 2006
Posts: 14
Hello Paolo Di Leo, i am g

Hello Paolo Di Leo,

i am going to include your two nice BASIC-Progis
at my A-ONE CDROM.
Very nice made !!!! CONGRATULATIONS !!!!
It's funny programming in BASIC Smile)))))isn't it ???

br
Franz

italianapple's picture
Offline
Joined: Jan 28 2007
Posts: 94
Perfect !

No problem Franz,

i'm pleased that there useful, i am working on another apple basic program ..., well, it's still in my head ....

... basic is really cool, it's not used anymore, well, maybe with VB6 or .Net, but this is not the point, Woz Basic is a perfect way to keep alive the homebrewers of all the Apple I and Old Computers community.

Paul.