home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1987 June
/
1987-06.d64
/
fractionpractice
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
3KB
|
100 lines
10 ba=53281:bo=53280:rem on the plus 4/16, use ba=65301:bo=65305
20 x=rnd(-ti):deffnc(x1)=int(10*rnd(1))+1
30 pokeba,1:pokebo,0:printchr$(142)
40 print"[147] welcome to fraction practice[146]."
50 print" do you need instructions (y/n)";:inputi$
60 pokeba,0:pokebo,1
70 print"[147]to add or subtract fractions, you must
80 [153]"first give a common denominator (unless
90 print"the two denominators are already the
100 [153]"same). the common denominator must be
110 print"no larger than the two denominators
120 [153]"multiplied together. then give each new
130 print"numerator and finally, give the answer."
140 print"you may then be asked to simplify your
150 [153]"answer.
160 printtab(12)"press any key...
170 [161] q$:[139] q$[178]""[167]170
180 [153]"loadif you need to ewaitscape back to the"
190 [153]"start of any problem,";
200 [153]" just enter e:wait"
210 [153]"remember... to ewaitscape, enter e:wait."
220 [153]"which operation would you care to try?
230 print" 1 = addition, or
240 [153]" 2 = subtraction ";
250 [133]m:[139] m[179]1 [176] m[177]2 [167]180
260 [153]"load":[151]ba,4:[151]bo,7[170]5[172]16:p[178]0
270 x[178][165]c(x1):y[178][165]c(x1):[139]x[177][178]y[167]270
280 a[178][165]c(x1):b[178][165]c(x1):[139]a[177][178]b[167]280
290 [139] m[178]2 [175] x[173]y[179][178]a[173]b [167]270
300 p[178]p[170]1:[139] p[177]20 [167]940
310 [153]"loadsysthis is problem number"p"cmd.":[153]" "x[163]10)a
320 p$[178]"+":[139]m[178]2[167]p$[178]"-"
330 [153]" lenlen "p$" lenlen =":[153]" "y[163]10)b
340 [153]"the common denominator is ";
350 [139] y[178]b [167] [153]y:t[178]y:[137]470
360 [133] t
370 [139] t[178]e [167]310
380 [139] t[178]0 [167] [153]"the denominator can't be zero.ononon":[137]340
390 [139] t[177]b[172]y [167] [153]"please find a smaller one. ":[137]340
400 [129] d[178]1 [164] b[172]y
410 [139] (b[172]y)[173]d[178][181]((b[172]y)[173]d) [175] [181]((b[172]y)[173]d) [167]440
420 [130] d
430 [137]460
440 [139] t[173]b[178][181](t[173]b) [175] t[173]y[178][181](t[173]y)[167]470
450 [130] d
460 [153]"sorry, that number won't work...ononon":[137]340
470 [153]" lenlen "p$" lenlen =":[153][163]2)t[163]10)t
480 [153]"the first numerator is...ononononcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmd";
490 [133] s1
500 [139] s1[178]e [167]310
510 [153]"on "s1
520 [139] s1[179][177]t[173]y[172]x [167] [153]"sorry, try again...ononon":[137]480
530 [153]"the second numerator is...onononononcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmd";
540 [133] s2
550 [139] s2[178]e [167]310
560 [153][163]8)"on "s2
570 [139] s2[179][177]t[173]b[172]a [167] [153]"sorry, try again...onononononon" :[137]530
580 [153]"your answer is... lenlen";:[153]"oncmdcmdcmdcmd";:[133]s3
590 [139] s3[178]e [167]310
600 [153][163]18)"on "s3
610 [153]""[163]18);:[133] t1:[153][163]18)"on "t1
620 [139] t1[178]e [167]310
630 [139](m[179][177]1 [176] s3[178]s1[170]s2)[175] (m[179][177]2 [176] s3[178]s1[171]s2)[167]650
640 [153]"wrong numerator...ononononononononononon":[137]580
650 [139] t1[179][177]t [167] [153]"wrong denominatorononononononononononon":[137]580
660 [139] s3[179]t1 [167]790
670 [153]"please change to a mixed numberonononcmdcmdcmdcmdcmdcmdcmdcmdcmd = ";:[133]m1
680 [139] m1[178]e [167]310
690 [139] m1[179][177]1[167][153]"try again... onon":[137]670
700 [153][163]27)"ononcmd(NULL)sgncmdcmdcmd sgncmdcmdand(NULL)onon";:[139]s3[178]t1[167][153]"":[137]910
710 [133]s5:[139] s5[178]e [167]310
720 [153]"on"[163]28)" "s5
730 [139] s5[179][177]s3[171]t1 [167][153]"try again... ononon":[137]700
740 [153][163]30)"lenlencmdcmdcmdcmd";:[133]t5
750 [139] t5[178]e [167]310
760 [153]"on"[163]28)" "t5
770 [139] t5[179][177]t1 [167] [153]"try again... onononcmdcmdcmdcmd"[163]26);:[137]740
780 s3[178]s5
790 [129] g[178](b[172]y)[164] 2 [169] [171]1
800 [139] s3[173]g[178][181](s3[173]g) [175] t1[173]g[178][181](t1[173]g) [167]820
810 [130] g:[137] 910
820 [153]"please simplify... onononcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmd=on";
830 [153][163]28);:[133] s4:[153]"on"[163]28)" "s4" ":[153][163]30)"lenlen"
840 [139] s4[178]e [167]310
850 [153][163]28):[133] t2
860 [139] t2[178]e [167]310
870 [153]"on"[163]28)" "t2
880 [139] s4[178]s3[173]g [175] t2[178]t1[173]g [167] [137]910
890 [153]"incorrect...please simplify again ononononcmdcmdcmdcmdcmdcmdcmdcmd";:[137]830
900 [153]"incorrect... ":[137]830
910 [153]"well done!wait"
920 [141]990
930 [137]270
940 [153]"do you wish another set of problems"
950 [153]"(y/n)";
960 [133] q$
970 [139] q$[179][177]"y"[167][153]"load":[128]
980 [137]180
990 [129]v[178]1[164]400:[130]v:[142]