7.8题用VB怎么做?谢谢你们啦!
1个回答
展开全部
Sub s()
Dim arr(18)
Randomize
For i = 1 To 10000
k = 0
For j = 1 To 3
k = k + Int(Rnd * 6 + 1)
Next
arr(k) = arr(k) + 1
Next
For i = 0 To 2
m = 0
For j = 3 To 18
If arr(j) > m Then
m = arr(j)
arr(i) = j
End If
Next
arr(arr(i)) = 0
Next
MsgBox "次数最高三个数为:" & arr(0) & "," & arr(1) & "," & arr(2)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询