home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug061.arc
/
CALCULAT.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1979-12-31
|
6KB
|
228 lines
STOR '0' TO PA
set talk off
STOR 'T' TO MORE
DO WHIL MORE
STOR 'T' TO T
stor ' ' to OA
STOR ' ' TO WA
@ 5,56 SAY'|SELECT AND TYPE No. '
@ 6,56 SAY'|OF OPERATION REQUIRED '
@ 7,56 SAY'|1.ADDITION/SUBTRACTION '
@ 8,56 SAY'|2.MULTIPLICATION '
@ 9,56 SAY'|3.DIVISION '
@ 10,56 SAY'| '
@ 10,56 SAY'|0.RETURN TO FILES'get OA
@ 11,56 SAY'| '
@ 12,56 SAY'| '
@ 13,56 SAY'| '
@ 14,56 SAY'| '
@ 15,56 SAY'| '
@ 16,56 SAY'| '
@ 17,56 SAY'| '
@ 18,56 SAY'| '
? chr(7)
SET bell OFF
read noup
SET bell ON
IF OA=' '
LOOP
ENDI
IF &Oa < 1
RETU
ENDIF
IF OA='1'
set talk off
STOR 0 TO QA
stor 0 to RA
STOR 0 TO SA
DO WHIL T
STOR PA TO RA
STOR 000.000 TO PA
@ 5,56 SAY '|No. TO ADD'GET PA
@ 6,56 SAY '| '
IF QA>0
@ 7,56 SAY '|LAST TOTAL '
@ 7,69 SAY SA
@ 8,56 say'| + '
@ 9,56 say '| '
@ 9,60 say RA
else
@ 7,56 SAY '| '
@ 8,56 SAY '| '
@ 9,56 SAY '| '
endif
@ 10,56 SAY '| '
if QA # 0
@ 11,56 SAY '|TOTAL SO FAR '
@ 11,69 SAY QA
else
@ 11,56 say '| '
endif
@ 12,56 say chr(7)
@ 13,56 SAY '| '
@ 14,56 SAY '| '
@ 15,56 SAY '| '
@ 16,56 SAY '| '
set bell off
read noup
set bell on
STOR QA TO SA
STOR PA+QA TO QA
IF PA# 0
loop
else
@ 15,56 say '| GRAND TOTAL = '
@ 16,56 SAY '| '
@ 16,58 SAY QA
STOR ' ' TO TA
@ 17,56 SAY '| PRESS A KEY TO '
@ 18,66 say' '
@ 18,56 SAY '| CONTINUE'GET TA
@ 19,56 SAY CHR(7)
SET BELL OFF
READ NOUP
SET BELL ON
STOR F TO T
LOOP
endif
ENDIF
endif
IF OA='2'
STOR ' ' TO NA
@ 5,56 say '| MULTIPLICATION '
@ 6,56 SAY '|RESULTS ADDED TOGETHER '
@ 7,56 SAY'| '
@ 8,56 SAY '| '
@ 9,56 SAY '| '
@ 10,56 SAY '| '
@ 11,56 SAY '| '
@ 12,56 SAY CHR(7)
STOR 000.000 TO PA
STOR 000.000 TO QA
STOR 000.000 TO RA
STOR 000.000 TO SA
DO WHIL T
stor 000.000 to PA
stor 000.000 to qa
@ 7,56 SAY'|FIRST NUMBER? '
@ 8,56 SAY'|ZERO TO QUIT '
@ 9,57 GET PA
@ 10,56 SAY'|SECOND NUMBER? '
@ 11,56 SAY'| '
@ 12,57 GET QA
@ 12,80 SAY CHR(7)
SET BELL OFF
READ NOUP
SET BELL ON
IF PA=0
STOR F TO T
STOR ' ' TO UA
@ 7,56 SAY'| '
@ 8,56 SAY'| '
@ 9,56 SAY'| '
@ 10,56 SAY'| '
@ 11,56 SAY'| '
@ 12,56 say '| GRAND TOTAL '
@ 12,69 SAY SA
@ 13,56 SAY'|DO YOU WANT TO ADD '
@ 14,56 SAY '| '
@ 14,56 SAY'|A PERCENTAGE?'GET UA
@ 15,56 say '| '
@ 16,73 SAY CHR(7)
@ 16,56 SAY '| '
@ 17,56 say'| '
@ 18,56 say'| '
@ 19,56 SAY'| '
@ 20,56 SAY'| '
SET BELL OFF
READ NOUP
SET BELL ON
STOR 00.00 TO VA
IF!(UA)='Y'
@ 13,56 say '| '
@ 14,56 SAY '| '
@ 13,56 SAY '|AT WHAT RATE?'GET VA
@ 12,78 say chr(7)
set bell off
read noup
set bell on
@ 13,56 SAY'| '
@ 14,56 say '| PLUS'+STR(VA,6,2)+'%'
@ 15,56 say '| '
@ 15,57 SAY STR((SA*(100+VA)/100),10,3)
ENDI
STOR ' ' TO TA
IF !(UA)#'Y'
@ 13,56 SAY'| '
@ 14,56 SAY'| '
ENDI
@ 16,56 SAY '| PRESS A KEY TO '
@ 17,56 SAY'| CONTINUE'GET TA
@ 17,80 SAY CHR(7)
SET BELL OFF
READ NOUP
SET BELL ON
LOOP
ENDI
STOR(PA*QA) TO RA
STOR RA+SA TO SA
@ 14,56 SAY '|'
@ 14,57 SAY PA
@ 14,66 SAY ' x '
@ 14,70 SAY QA
@ 15,56 say'| TOTAL '
@ 16,56 SAY '|'
@ 16,58 SAY RA
@ 17,56 say'| '
@ 18,56 SAY'| TOTALS SO FAR '
@ 19,56 SAY '| ADD UP TO... '
@ 20,58 SAY SA
ENDD
ENDI
IF OA='3'
STOR 000.000 TO RA
STOR 000.000 TO QA
@ 5,56 SAY '| ---DIVISION--- '
@ 6,56 SAY '|MORE ZEROS MAKE ANSWER'
@ 7,56 SAY '|MORE ACCURATE! '
DO WHIL T
@ 8,56 SAY'|LONG NO.:(ZERO TO QUIT) '
@ 9,56 SAY'| '
@ 9,58 GET RA
@ 10,56 SAY'|SHORT NUMBER: '
@ 11,56 SAY'| '
@ 11,58 GET QA
@ 10,78 SAY CHR(7)
SET BELL OFF
READ NOUP
SET BELL ON
IF RA=0
STOR F TO T
LOOP
ENDI
@ 12,56 SAY '|THE ANSWER IS '
@ 13,56 SAY '|'
@ 13,58 SAY RA/QA
@ 14,56 SAY '|RECIPROCAL IS '
@ 15,56 SAY '|'
@ 15,58 SAY QA/RA
ENDDO
endi
endd
ENDDO
ENDDO
ENDD
ENDDO
ENDDO
ENDD
'
if QA # 0
@ 11,56 SAY '|TOTAL SO FAR '
@ 11,69 SAY QA
else
@ 11,56 say '| '
endif
@ 12,56 say chr