Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Filter/REXX/filter-1.rexx
Normal file
19
Task/Filter/REXX/filter-1.rexx
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/*REXX program selects all even numbers from an array and puts them */
|
||||
/* into a new array. */
|
||||
Parse Arg n seed . /* obtain optional arguments from CL*/
|
||||
If n==''|n=="," Then n=50 /* Not specified? use the default */
|
||||
If datatype(seed,'W') Then
|
||||
Call random,,seed /* use RANDOM seed for repeatability*/
|
||||
Do i=1 For n /* generate N random numbers */
|
||||
old.i=random(1,99999) /* generate random number */
|
||||
End
|
||||
m=0 /* number of elements in NEW */
|
||||
Do j=1 To n /* process the elements of the OLD */
|
||||
If old.j//2==0 Then Do /* if element is even, then */
|
||||
m=m+1 /* bump the number of NEW elemens */
|
||||
new.m=old.j /* assign the number to the NEW */
|
||||
End
|
||||
End
|
||||
Do k=1 For m /* display all the NEW numbers. */
|
||||
Say right('new.'k,20) '=' right(new.k,9)
|
||||
End
|
||||
17
Task/Filter/REXX/filter-2.rexx
Normal file
17
Task/Filter/REXX/filter-2.rexx
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/*REXX program uses a control array to tell which elements ars even. */
|
||||
Parse Arg n seed . /* obtain optional arguments from CL*/
|
||||
If n==''|n=="," Then n=50 /* Not specified? use the default */
|
||||
If datatype(seed,'W') Then
|
||||
Call random,,seed /* use RANDOM seed for repeatability*/
|
||||
Do i=1 For n /* generate n random numbers */
|
||||
x.i=random(1,99999) /* generate random number */
|
||||
End
|
||||
even.=0 /* all even bits are off */
|
||||
Do j=1 To n /* process the elements of x.* */
|
||||
If x.j//2==0 Then /* if element is even, then */
|
||||
even.j=1 /* turn on the even bit */
|
||||
End
|
||||
Do k=1 To n /* display all the numbers */
|
||||
If even.k Then /* that are even */
|
||||
Say right('x.'k,20) '=' right(x.k,9)
|
||||
End
|
||||
16
Task/Filter/REXX/filter-3.rexx
Normal file
16
Task/Filter/REXX/filter-3.rexx
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*REXX program sets all elements containing odd numbers to blank */
|
||||
Parse Arg n seed . /* obtain optional arguments from CL*/
|
||||
If n==''|n=="," Then n=50 /* Not specified? use the default */
|
||||
If datatype(seed,'W') Then
|
||||
Call random,,seed /* use RANDOM seed for repeatability*/
|
||||
Do i=1 For n /* generate N random numbers */
|
||||
x.i=random(1,99999) /* generate random number */
|
||||
End
|
||||
Do j=1 To n /* process the elements of x.* */
|
||||
If x.j//2<>0 Then /* if element is not even, then */
|
||||
Drop x.j /* delete it */
|
||||
End
|
||||
Do k=1 To n /* display all the numbers */
|
||||
If datatype(x.k)='NUM' Then /* that are even */
|
||||
Say right('x.'k,20) '=' right(x.k,9)
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue