主题:求救,VB中动态数组赋值问题
1:
For j = n - 1 To 1 Step -1
While num(j) > 0
xx = xx + 1
length = a
num(j) = num(j) - 1
For k = 1 To j
length = length - b(k) * num(k)
Next k
For k = j + 1 To n
num(k) = 0
Next k
num(j + 1) = Int(length / b(j + 1))
length = length - num(j + 1) * b(j + 1)
For k = j + 1 To n - 1
If length >= b(k + 1) Then
num(k + 1) = Int(length / b(k + 1))
length = length - num(k + 1) * b(k + 1)
Else
num(k + 1) = 0
End If
Next k
If length < max Then
ReDim DR(1 To xx, 1 To n) As Double
ReDim dlength(1 To xx) As Double
ReDim dstr(1 To xx) As String
For i = 1 To n
DR(xx, i) = num(i)
Next i
dlength(xx) = length
str = ""
For i = 1 To n
If num(i) <> 0 Then
str = str & num(i) & "*" & b(i) & "+"
End If
Next i
str = Mid(str, 1, Len(str) - 1) & "=" & a - length
dstr(xx) = str
Else
xx = xx - 1
End If
'-------------------------------------------
If Not (num(j) = 0 And num(j + 1) = 0) Then
GoTo 1
End If
Wend
Next j
这里面的DR()可以这样么?求救
For j = n - 1 To 1 Step -1
While num(j) > 0
xx = xx + 1
length = a
num(j) = num(j) - 1
For k = 1 To j
length = length - b(k) * num(k)
Next k
For k = j + 1 To n
num(k) = 0
Next k
num(j + 1) = Int(length / b(j + 1))
length = length - num(j + 1) * b(j + 1)
For k = j + 1 To n - 1
If length >= b(k + 1) Then
num(k + 1) = Int(length / b(k + 1))
length = length - num(k + 1) * b(k + 1)
Else
num(k + 1) = 0
End If
Next k
If length < max Then
ReDim DR(1 To xx, 1 To n) As Double
ReDim dlength(1 To xx) As Double
ReDim dstr(1 To xx) As String
For i = 1 To n
DR(xx, i) = num(i)
Next i
dlength(xx) = length
str = ""
For i = 1 To n
If num(i) <> 0 Then
str = str & num(i) & "*" & b(i) & "+"
End If
Next i
str = Mid(str, 1, Len(str) - 1) & "=" & a - length
dstr(xx) = str
Else
xx = xx - 1
End If
'-------------------------------------------
If Not (num(j) = 0 And num(j + 1) = 0) Then
GoTo 1
End If
Wend
Next j
这里面的DR()可以这样么?求救