'实现代码如下
Private Sub Form_Click()
Me.Cls
Dim n(1 To 30) As Integer
Dim i%,nMax%
Dim str As String
'产生30个0-1000的随机数并写入数组
Randomize
For i = 1 To 30
n(i) = Int((1000 - 0 + 1) * Rnd + 0)
str = str & n(i) & " "
If i Mod 10=0 Then str=str & vbCrLf
Next i
'找最大值
nMax=n(1)
For i = 1 To 30
If n(i)>nMax Then nMax=n(i)
Next i
Print str '窗体显示随机数
Print "最大值:" & nMax
End Sub
'实现代码如下
Private Sub Form_Click()
Me.Cls
Dim n(1 To 30) As Integer
Dim i%,nMax%
Dim str As String
'产生30个0-1000的随机数并写入数组
Randomize
For i = 1 To 30
n(i) = Int((1000 - 0 + 1) * Rnd + 0)
str = str & n(i) & " "
If i Mod 10=0 Then str=str & vbCrLf
Next i
'找最大值
nMax=n(1)
For i = 1 To 30
If n(i)>nMax Then nMax=n(i)
Next i
Print str '窗体显示随机数
Print "最大值:" & nMax
End Sub
机整数,放入