close
'產生100個亂數介於1-6之間
'計算出1-6出現次數,並且次數全部加總要100次
Private Sub Form_Activate()
Randomize
Dim count(6) As Integer '記錄筆數
Dim Num As Integer
For i = 1 To 100
Num = Int(Rnd() * 6) + 1
count(Num) = count(Num) + 1
Next i
For i = 1 To 6
Print i & " 出現 " & count(i) & " 次"
Next i
End Sub
全站熱搜
留言列表