Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -1,26 +1,24 @@
|
|||
/*REXX pgm gets 2 integers from the C.L. or via prompt, shows some opers*/
|
||||
numeric digits 20 /*all numbers are rounded at ··· */
|
||||
/*··· the 20th significant digit.*/
|
||||
parse arg x y . /*maybe the integers are on C.L.?*/
|
||||
if y=='' then do /*nope, then prompt user for 'em.*/
|
||||
say "─────Enter two integer values (separated by blanks):"
|
||||
parse pull x y .
|
||||
end
|
||||
do 2 /*show A with B, then B with A.*/
|
||||
say /*show blank line for eyeballing.*/
|
||||
/*REXX pgm gets 2 integers from the C,L. or via prompt; shows some operations.*/
|
||||
numeric digits 20 /*#s are round at 20th significant dig.*/
|
||||
parse arg x y . /*maybe the integers are on the C.L. */
|
||||
|
||||
call show 'addition' , "+", x+y
|
||||
call show 'subtraction' , "-", x-y
|
||||
call show 'multiplication', "*", x*y
|
||||
call show 'int division' , "%", x%y, ' [rounds down]'
|
||||
call show 'real division' , "/", x/y
|
||||
call show 'div remainder' , "//", x//y, ' [sign from 1st operand]'
|
||||
call show 'power' , "**", x**y
|
||||
do while \datatype(x,'W') | \datatype(y,'W') /*both X and Y must be ints.*/
|
||||
say "─────Enter two integer values (separated by blanks):"
|
||||
parse pull x y . /*accept two items from command line. */
|
||||
end /*while ··· */
|
||||
/* [↓] perform this DO loop twice. */
|
||||
do j=1 for 2 /*show A oper B, then B oper A.*/
|
||||
call show 'addition' , "+", x+y
|
||||
call show 'subtraction' , "-", x-y
|
||||
call show 'multiplication' , "*", x*y
|
||||
call show 'int division' , "%", x%y, ' [rounds down]'
|
||||
call show 'real division' , "/", x/y
|
||||
call show 'division remainder', "//", x//y, ' [sign from 1st operand]'
|
||||
call show 'power' , "**", x**y
|
||||
|
||||
parse value x y with y x /*swap the two values & do again.*/
|
||||
end /*2*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────SHOW subroutine─────────────────────*/
|
||||
show: parse arg what,oper,value,comment
|
||||
say right(what,25)' ' x center(oper,4) y ' ───► ' value comment
|
||||
return
|
||||
parse value x y with y x /*swap the two values and perform again*/
|
||||
if j==1 then say copies('═', 79) /*display a fence after the 1st round. */
|
||||
end /*j*/
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*────────────────────────────────────────────────────────────────────────────*/
|
||||
show: parse arg c,o,#,?; say right(c,25)' ' x center(o,4) y ' ───► ' # ?; return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue