Need Help about array....Thanks..

Just starting out? Need help? Post your questions and find answers here.
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

Need Help about array....Thanks..

Post by Fasasoftware »

Dear friends,

i try to work on array....

ok i declare it like this....:

Code: Select all


Dim Secondarray(60)

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 :oops:
User avatar
Arbrakaan
Posts: 91
Joined: Mon Feb 24, 2014 10:54 pm
Location: Geneva
Contact:

Re: Need Help about array....Thanks..

Post by Arbrakaan »

Code: Select all

     If conta < 61 
       For y = 0 To 60
          Secondarray(y) = Round(tsec1/60)
         debug Secondarray(y)        
      Next
     EndIf
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

Re: Need Help about array....Thanks..

Post by Fasasoftware »

thanks a lot Arbrakaan, i'll try your code...thanks again lestroso :P
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

Re: Need Help about array....Thanks..

Post 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 :oops:
User avatar
Arbrakaan
Posts: 91
Joined: Mon Feb 24, 2014 10:54 pm
Location: Geneva
Contact:

Re: Need Help about array....Thanks..

Post by Arbrakaan »

Did you declare the array tsec1() and Secondarray() ?

I need more code to understand what you want to do.
Fasasoftware
Posts: 47
Joined: Tue May 26, 2015 11:22 pm

Re: Need Help about array....Thanks..

Post by Fasasoftware »

Here the little code example not working,,,,,

can somebody help me????

,,best regards lestroso :oops:

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


Post Reply