Option Base 1 Private Sub Form_Click() Dim a(10)As Integer,i As Integer Dim sum As Integer,aver As Single 【 】 For i=1 To 10 a(i)=Int(100*Rnd)+1 sum=sum+a(i) Next i 【 】 Print sum,aver End Sub
完整。 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
d1_Click() Dim a(25)As Integer,b(5,5)As Integer For i=1 To【 】 a(i)=Int(Rnd*25) Print a(i); Next i Print For i=1 To 5 For i=1 To 5 b(i,j)=【 】 Print b(i,j); Next j Print Next i End Sub