Page 1 of 1
Need Help about array....Thanks..
Posted: Wed May 25, 2016 1:47 pm
by Fasasoftware
Dear friends,
i try to work on array....
ok i declare it like this....:
This is ok...but i need to make like this....This below is like hypercard....but i need to translate this little piece of code in spiderbasic...Can somebody help me please?? thanks a lot in advance...
Lestroso
Code: Select all
if conta =60 then
put sum(tsec1) into tvaloremedia1
put tvaloremedia1 / 60 into tvaloremedia1
put trunc(tvaloremedia1) into tvaloremedia1
end if
i tryed to make this below but it don't work but i don't know i can do that..i saw the purebasic examples, but without success....
Code: Select all
If conta <61
For y = 0 To 60
Read Secondarray(y)
Next y
EndIf
Thanks again,lestroso

Re: Need Help about array....Thanks..
Posted: Wed May 25, 2016 5:52 pm
by Arbrakaan
Code: Select all
If conta < 61
For y = 0 To 60
Secondarray(y) = Round(tsec1/60)
debug Secondarray(y)
Next
EndIf
Re: Need Help about array....Thanks..
Posted: Wed May 25, 2016 7:28 pm
by Fasasoftware
thanks a lot Arbrakaan, i'll try your code...thanks again lestroso

Re: Need Help about array....Thanks..
Posted: Wed May 25, 2016 7:46 pm
by Fasasoftware
Code: Select all
if conta <61 then
put teurusdtot into tsec1[punta]
add 1 to punta
end if
if conta =60 then
put sum(tsec1) into tvaloremedia1
put tvaloremedia1 / 60 into tvaloremedia1
put trunc(tvaloremedia1) into tvaloremedia1
end if
In truth i need to translate these little piece of code....,.
I have tryed the last suggestion but the compiler say to me that is not a funtion or array....this below:
Code: Select all
If conta < 61
For y = 0 To 60
secondarray(y) = Round(tsec1/60)
Debug Secondarray(y)
Next
EndIf
in other words...don't work...any idea??? thanks to everybody lestroso

Re: Need Help about array....Thanks..
Posted: Wed May 25, 2016 10:19 pm
by Arbrakaan
Did you declare the array tsec1() and Secondarray() ?
I need more code to understand what you want to do.
Re: Need Help about array....Thanks..
Posted: Thu May 26, 2016 10:46 am
by Fasasoftware
Here the little code example not working,,,,,
can somebody help me????
,,best regards lestroso
Code: Select all
Dim secondarray(60)
Global totale.i=10
Global conta.i=1
Global valoreriferimento.i=0
Global punta.i=1
Repeat
; I PUT IN "TOTALE" VAR A NUMBER OF MINE in this case for example 10;
conta=conta+1
If conta = 1
valoreriferimento=totale
EndIf
If conta < 61
punta=conta
Secondarray(punta) = (totale)
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;I NEED BELOW TO SUM ALL THE SECONDARRAY-DIVIDE FOR 60 AND
;TRUNCATE THE VALUE TO INTEGER NOT FLOAT....
If conta = 60
punta=conta
secondarray(punta) = Round(secondarray/60) ;THE COMPILER SAY TO ME INCORECT NUMBER OF PARAMETERS
Debug Secondarray(punta)
Next
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If conta=60
conta=1
EndIf
ForEver