下标越界怎么办,跪求高手
PrivateSubhuazheng(m1,n1)DimiAsDoubleDimjAsIntegeri=Val(Text1.Text)m1=1n1=Mid(i,3)For...
Private Sub huazheng(m1, n1)
Dim i As Double
Dim j As Integer
i = Val(Text1.Text)
m1 = 1
n1 = Mid(i, 3)
For j = 1 To Len(n1)
m1 = m1 & "0"
Next
End Sub
Private Sub Command1_Click()
Dim x_array(), f_array(), m_array()
Static j
Dim m, n As Long
Dim r As Long
Dim x As Integer, y As Integer, k As Integer
Call huazheng(m, n)
Print "m="; m; ",n="; n
Do
ReDim Preserve x_array(j)
x = m \ n
x_array(j) = x
j = j + 1
r = m Mod n
m = n
n = r
Loop While (r <> 0)
Print "j="; j
Print Join(x_array, ",")
ReDim f_array(j)
ReDim m_array(j)
f_array(0) = x_array(0) * 0 + 1
f_array(1) = x_array(1) * f_array(0) + 0
m_array(0) = x_array(0) * 1 + 0
m_array(1) = x_array(1) * m_array(0) + 1
For k = 0 To j
f_array(k) = x_array(k) * f_array(k - 1) + f_array(k - 2)
m_array(k) = x_array(k) * m_array(k - 1) + m_array(k - 2)
Next k
Print Join(m_array, ",")
End Sub 展开
Dim i As Double
Dim j As Integer
i = Val(Text1.Text)
m1 = 1
n1 = Mid(i, 3)
For j = 1 To Len(n1)
m1 = m1 & "0"
Next
End Sub
Private Sub Command1_Click()
Dim x_array(), f_array(), m_array()
Static j
Dim m, n As Long
Dim r As Long
Dim x As Integer, y As Integer, k As Integer
Call huazheng(m, n)
Print "m="; m; ",n="; n
Do
ReDim Preserve x_array(j)
x = m \ n
x_array(j) = x
j = j + 1
r = m Mod n
m = n
n = r
Loop While (r <> 0)
Print "j="; j
Print Join(x_array, ",")
ReDim f_array(j)
ReDim m_array(j)
f_array(0) = x_array(0) * 0 + 1
f_array(1) = x_array(1) * f_array(0) + 0
m_array(0) = x_array(0) * 1 + 0
m_array(1) = x_array(1) * m_array(0) + 1
For k = 0 To j
f_array(k) = x_array(k) * f_array(k - 1) + f_array(k - 2)
m_array(k) = x_array(k) * m_array(k - 1) + m_array(k - 2)
Next k
Print Join(m_array, ",")
End Sub 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询