MediaWiki:Sitenotice:
2024-03-02: The wiki ran out of disk space, so things were not working. This has been resolved by adding another 5GB of quota ;-) Thanks to Tim Lindner for reporting the issues. 2020-05-17: If a page gives you an error about some revision not being found, just EDIT the page and the old page should appear in the editor. If it does, just SAVE that and the page should be restored. OS-9 Al (talk) 12:22, 17 May 2020 (CDT)

ADDSUB: Difference between revisions

From CoCopedia - The Tandy/Radio Shack Color Computer Wiki
Jump to navigation Jump to search
(Category)
mNo edit summary
 
Line 56: Line 56:
  650 RETURN
  650 RETURN


[[Category:Programming]]
[[Category:BASIC]]

Latest revision as of 20:41, 10 September 2015

100 DIMLM(5,2),MS$(5)
110 DATA0,9,10,99,100,999,1000,9999,10000,99999
120 DATA"GOOD WORK?","KEEP IT UP?","NICE GOING?","YOU'RE DOING GREAT"
130 DATA"FANTASTIC?"
140 FORT=1TO5
150 READLM(T,1),LM(T,2):NEXTT
160 FORT=1TO5
170 READNS$(T):NEXTT
180 CLS
190 PRINT@92,"ADDITION/SUBTRACTION PROGRAM"
200 PRINT@64,"SELECT ONE OF THE FOLLOWING:"
210 PRINT@96,"A. ADDITION"
220 PRINT@128,"B. SUBTRACTION"
230 PRINT@160,"WHICH ONE";:INPUTA$
240 IFA$="A"THEN290
250 IFA$="B"THEN350
260 PRINT@224,"INVALID SELECTION--TRY AGAIN"
270 FORT=1TO300:NEXTT
280 PRINT@224,"";:PRINT:PRINT@171,"":GOTO230
290 REM ADDITION
300 C=1:T1=0:T2=0
310 A1=RND(LM(C,2)):A2=RND(LM(C,2))
320 IF(A1<LM(C,1))OR(A2<LM(C,1))THEN310
330 A3=A1+A2:GOSUB410
340 GOTO310
350 REM SUBTRACTION
360 C=1:T1=0:T2=0
370 A1=RND(LM(C,2)):A2=RND(LM(C,2))
380 IF(A1<LM(C,1))OR(A2<LM(C,1))OR(A1<A2)THEN370
390 A3=A1-A2:GOSUB410
400 GOTO370
410 REM PRINT SUBROUTINE
420 CLS
430 IFA$="A"THENPRINT@12,"ADDITION":PRINT@166,"+":GOTO450
440 PRINT@10,"SUBTRACTION":PRINT@166,"-"
450 PRINT@135,A1:PRINT@167,A2
460 PRINT@167,A2
470 PRINT@198,"-------"
480 B$=STR$(A2):C$=STR$(A3)
490 IFA$="A"THENPRINT@230-(LEN(C$)-LEN(B$)),"";:INPUTT:GOTO510
500 PRINT@230+(LEN(B$)-LEN(C$)),"";:INPUTT
510 T2=T2+1
520 IFT=A3THEN540
530 PRINT"WRONG! THE ANSWER IS";A3:GOTO570
540 T1=T1+1
550 IF((T2/10)=INT(T2/10))AND((T1/T2)>.6)THENPRINT@238,MS$(C)
560 PRINT@320,"C0RRECT!";T1;"0UT OF";T2
570 PRINT@384,"ENTER H FOR HARDER, E FOR"
580 PRINT@416,"EASIER, R FOR RESTART, OR"
590 PRINT@448,"JUST <ENTER> FOR SAME";:INPUTB$
600 IFB$="R"THEN180
610 IFB$=""THEN650
620 IF(B$="E")AND(C>1)THENC=C-1:GOTO650
630 IF(B$="H")AND(C<5)THENC=C+1:GOTO650
640 GOTO570
650 RETURN