Convert to VB6 in basic4ppc

GallyHC

Member
Hello,

I'm a french man and i'm sorry for my bad english.

please help me for the convert a code vb6 to basic4ppc (tab). the code is :

'Dim tabCos(-360 To 360) As Single
'Dim tabSin(-360 To 360) As Single

And

'For i=-360 To 360 Step 1
' tabCos(i) = Sin((i/180) * dblPi)
' tabSin(i) = Cos((i/180) * dblPi)
'Next i

thank you,
GallyHC
 

Erel

Administrator
Staff member
Licensed User
Arrays index in Basic4ppc always start from 0.
It is better to declare the arrays as Double in Basic4ppc because all internal calculations are done with this type.
B4X:
Sub Globals
    Dim tabCos(721) As Double
    Dim tabSin(721) As Double
End Sub

Sub App_Start
    For i = -360 To 360 Step 1
        tabCos(360 + i) = Sin((i/180) * cPi) 'cPi is a constant (3.1415...)
        tabSin(360 + i) = Cos((i/180) * cPi)
    Next
End Sub
 
Top