用VB程序设计有关掷三个骰子游戏,由人和电脑对战,双方各5000分,每次押100分,3-10为小,11-18为大求代码

发布于2022-01-13 17:23:01
3个回答
admin
网友回答2022-01-13
这就是一个随机数的问题,如下:
Dim a1 As Integer, a2, a3 As Integer

Call ks
a1 = i
Label4.Caption = a1
i = 0
Call ks
a2 = i
Label5.Caption = a2
i = 0
Call ks
a3 = i
Label6.Caption = a3
i = 0
If a1 + a2 + a3 = 10 Then
rs = 1
Label1.ForeColor = vbRed
Else
rs = 0
Label2.ForeColor = vbRed
End If

Private Sub ks()

i = Round(Rnd * 6 + 1, 0)
If i 6 Then
i = 6
End If

End Sub
具体的自己写,不好意思
admin
网友回答2022-01-13
我会写,但家里没VB!!!!
admin
网友回答2022-01-13
飘过,预祝大神帮你解答~~

回到
顶部