要打印出50个在-100~100之间不同的随机整数,并找出第几个是最大数。给定的程序不完整,将程序补充完整。
Option Base 1
Private Sub Command1_Click( )
Dim b( )
Randomize
______
Do
x = Rnd
If x > 0.5 Then y = 1 Else y = -1
t = y * Int(Rnd * 100)+ 1
______
Do While k < j
If t <> b(k)Then
k = k + 1
Else
Exit Do
End If
Loop
If k = j Then
ReDim Preserve b(k)
b(k)= t
Print b(k);
j = j + 1
End If
Loop Until j > 50
Print
______
Max = b(1)
For n = 2 To 50
If b(n)> Max Then
______
p = n
End If
Next n
Print "最大数是:"; Max
Print "位置在第"; p; "个"
End Sub