用隨機(jī)函數(shù)產(chǎn)生10個(gè)50以內(nèi)包括50的隨機(jī)整數(shù)存入一堆數(shù)組?
Private Sub Command1_Click() Dim a(10) As Integer Randomize Print "產(chǎn)生的隨機(jī)數(shù)是:" For i = 1 To 10 a(i) = Int(Rnd * 51) Print a(i); Next i Print x = CInt(InputBox("請(qǐng)輸入要查找的數(shù):")
) Print "要查找的數(shù)是:"; x n = 0 For i = 1 To 10 If x = a(i) Then n = n + 1 Next i Print "出現(xiàn)了"; n; "次" Print: PrintEnd Sub