VB一维数组赋值的问题
发布网友
发布时间:2024-10-09 05:26
我来回答
共3个回答
热心网友
时间:2024-11-29 16:49
Private Sub Command1_Click()
Dim a(0 To 9) '定义个数组大小为10
For i = 0 To 9
a(i) = Int(Rnd * 10 + 1) '给数组赋随机值
Next i
For j = 0 To 9
Print a(j) '打印数组的元素值
Next j
End Sub
这很简单吧
热心网友
时间:2024-11-29 16:49
Private Sub Form_click()
Dim a(1 To 10) As Single
Randomize
a(1) = Int(Rnd * 10 + 1)
i = 2
Print a(1)
Do
lp: Randomize
a(i) = Int(Rnd * 10 + 1)
For j = 1 To i - 1
If a(i) = a(j) Then
GoTo lp
End If
Next
Print a(i)
i = i + 1
Loop While i <= 10
End Sub
热心网友
时间:2024-11-29 16:50
point.print a(1 to 10)这是是打印把
至于赋值没看明白,偶也是新手,不太会