home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_07_08
/
v7n8056b.txt
< prev
next >
Wrap
Text File
|
1989-09-29
|
494b
|
23 lines
*****Listing 2*****
declare array to hold last N smaples.
load array with first N samples
set array_ptr to 1
calculate initial TOTAL for array
calculate initial result ( TOTAL / N )
while sampling not finished
take sample
calculate TOTAL = TOTAL + sample - array(array_ptr)
array(array_ptr) = sample
result = TOTAL / n
store result
if array_ptr < n
array_ptr = array_ptr + 1
else
array_ptr = 1
end if
end while