VB 函数 do while ...Loop 与 while .wend 的区别Dim D As VariantDim E() As IntegerDo While A1 0A1 = 0For i2 = 0 To UBound(D)If D(i2) > A1 ThenA1 = D(i2) End If 'D(i2) > A1Next 'i2 = 0ReDim Preserve E(i3) As Integer E(i3) = A1i3 = i3 + 1For i2 = 0
来源:学生作业帮助网 编辑:六六作业网 时间:2025/02/02 09:13:55
VB 函数 do while ...Loop 与 while .wend 的区别Dim D As VariantDim E() As IntegerDo While A1 0A1 = 0For i2 = 0 To UBound(D)If D(i2) > A1 ThenA1 = D(i2) End If 'D(i2) > A1Next 'i2 = 0ReDim Preserve E(i3) As Integer E(i3) = A1i3 = i3 + 1For i2 = 0
VB 函数 do while ...Loop 与 while .wend 的区别
Dim D As Variant
Dim E() As Integer
Do While A1 0
A1 = 0
For i2 = 0 To UBound(D)
If D(i2) > A1 Then
A1 = D(i2)
End If 'D(i2) > A1
Next 'i2 = 0
ReDim Preserve E(i3) As Integer
E(i3) = A1
i3 = i3 + 1
For i2 = 0 To UBound(D)
If D(i2) = A1 Then
D(i2) = 0
End If 'D(i2) > A1
Next 'i2 = 0
Loop
'这是一个排序用的,把数组元素(D)大到小排序去重复的复制到另一个(E).
'问,为什么do while ...Loop 与 while .wend 的输出没有区别?
VB 函数 do while ...Loop 与 while .wend 的区别Dim D As VariantDim E() As IntegerDo While A1 0A1 = 0For i2 = 0 To UBound(D)If D(i2) > A1 ThenA1 = D(i2) End If 'D(i2) > A1Next 'i2 = 0ReDim Preserve E(i3) As Integer E(i3) = A1i3 = i3 + 1For i2 = 0
do while ...loop和while ...wend没区别,完全一样,先判断条件再运行循环体.
do ...loop while就不一样了,先运行再判断