用VB做个概率测验的软件
- 提问者网友:蔚蓝的太阳
- 2021-06-05 01:26
+3~+4 95%
+4~+5 90%
+5~+6 80%
+6~+7 75%
+7~+8 62.1%
+8~+9 53.7%
+9~+10 41.4%
+10~+11 33.9%
+11~+12 28%
+12~+13 20.7%
+13~+14 17.3%
+14~+15 13.6%
+15~+16 10.1% 就是个装备从+1~+16 的概率
- 五星知识达人网友:拜訪者
- 2021-06-05 02:19
第一个文本框名称:text1
第二个文本框名称:text2
按钮名称:command1
窗口名称:form1
将以下代码贴到代码页中:
private jc as integer '装备加成系数
private cgl as double '冲装备成功系数,即你的100%/95%/……
private djcs as integer '点击次数
private sub form1_load() '启动窗口时初始化
jc=0
cgl=100
djcs=0
text1.text="+0装备"
text2.text=djcs
end sub
dim i as integer
private sub command1_click()
for i=1 to 500 '最多点击500次
Randomize(timer)
Dim RndNum As double
RndNum = (Rnd * 100) '产生一个随机数
if rndnum < (cgl) then
jc=jc+1
if jc<3 then cgl=100
if jc>=3 and jc<4 then cgl=95
if jc>=4 and jc<5 then cgl=90
if jc>=5 and jc<6 then cgl=80
if jc>=6 and jc<7 then cgl=75
if jc>=7 and jc<8 then cgl=62.1
if jc>=8 and jc<9 then cgl=53.7
if jc>=9 and jc<10 then cgl=41.4
if jc>=10 and jc<11 then cgl=33.9
if jc>=11 and jc<12 then cgl=28
if jc>=12 and jc<13 then cgl=20.7
if jc>=13 and jc<14 then cgl=17.3
if jc>=14 and jc<15 then cgl=13.6
if jc>=15 and jc<16 then cgl=10.1
if jc>=16 then
msgbox("你的装备+16了,重新开始。")
text1.text = "+" & jc & "装备"
text2.text = "i"
jc=0
cgl =100
i=501
end if
else
msgbox("你的装备爆了,重新开始。")
text1.text = "+" & jc & "装备"
text2.text = "i"
jc=0
cgl =100
i=501
end if
next
end sub
- 1楼网友:琴狂剑也妄
- 2021-06-05 02:28
不明白,你要输入什么数据再测试概率,况且如果是+3,算100%还是95%?