Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,45 @@
|
|||
INCLUDE "D2:REAL.ACT" ;from the Action! Tool Kit
|
||||
|
||||
PROC Mean(INT ARRAY a INT count REAL POINTER result)
|
||||
INT i
|
||||
REAL x,sum,tmp
|
||||
|
||||
IntToReal(0,sum)
|
||||
FOR i=0 TO count-1
|
||||
DO
|
||||
IntToReal(a(i),x)
|
||||
RealAdd(sum,x,tmp)
|
||||
RealAssign(tmp,sum)
|
||||
OD
|
||||
IntToReal(count,tmp)
|
||||
RealDiv(sum,tmp,result)
|
||||
RETURN
|
||||
|
||||
PROC Test(INT ARRAY a INT count)
|
||||
INT i
|
||||
REAL result
|
||||
|
||||
Mean(a,count,result)
|
||||
Print("mean(")
|
||||
FOR i=0 TO count-1
|
||||
DO
|
||||
PrintI(a(i))
|
||||
IF i<count-1 THEN
|
||||
Put(',)
|
||||
FI
|
||||
OD
|
||||
Print(")=")
|
||||
PrintRE(result)
|
||||
RETURN
|
||||
|
||||
PROC Main()
|
||||
INT ARRAY a1=[1 2 3 4 5 6]
|
||||
INT ARRAY a2=[1 10 100 1000 10000]
|
||||
INT ARRAY a3=[9]
|
||||
|
||||
Put(125) PutE() ;clear screen
|
||||
Test(a1,6)
|
||||
Test(a2,5)
|
||||
Test(a3,1)
|
||||
Test(a3,0)
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue