按键精灵怎么做到随机输出一个数组里数的并统计出现次数?

假如是一个数组里面有a,b,c,d
我需要随机输出其中一个
并且最后统计各数都出现了几次?

第1个回答  2013-10-26
Dim e(4),x
a=0
b=0
c=0
d=0
e(0)=100
e(1)=200
e(2)=300
e(3)=400
Rem start
Randomize
For 20
x = Int((4 * Rnd) + 0)
If x=3 Then
d=d+1
End If
If x=2 Then
c=c+1
End If
If x=1 Then
b=b+1
End If
If x=0 Then
a=a+1
End If
MessageBox e(x)
Next
MessageBox "数组e(1)"&a&" ,""数组e(2)"&b&" ,""数组e(3)"&c&" ,""数组e(4)"&d
s=a+b+d+c
MessageBox s本回答被提问者采纳
相似回答