Code: Select all
function corrected_data(x() as integer) as integer
dim as ulongint errc_data,divisor
for i as integer = lbound(x) to ubound(x) - 4
if x(i) = x(i+1) and x(i) = x(i+2) and x(i) = x(i+4) then
errc_data += x(i)
divisor+=1
PRINT "GOOD DATA @ ";I
end if
next
return errc_data / divisor
end function
sub generate_correctable_data (value as integer,v_data() as integer)
for i as integer = lbound(v_data) to ubound(v_data)
v_data(i)=value
next
end sub
dim as integer example(0 to 99)
'geratation of correctable_data_arrey
generate_correctable_data (512,example())
'now we corrupt some data of the arrey
randomize timer
for i as integer = 0 to 52
example(int(rnd*ubound(example)))=int(rnd*99999999)
next
'new we will output the correct data..
print corrected_data(example())
sleep
'and voila :)