vb.net做石头剪刀布小游戏

vb.net做石头剪刀布小游戏,我刚学vb.net不久,哪位高手给个程序,有操作步骤更好,谢谢!!!... vb.net做石头剪刀布小游戏,我刚学vb.net不久,哪位高手给个程序,有操作步骤更好,谢谢!!! 展开
 我来答
flamecontrol
2008-06-04 · TA获得超过143个赞
知道答主
回答量:70
采纳率:0%
帮助的人:84.6万
展开全部
我也是新手,随便做个玩玩。把RadioButton0,1,2放一个容器里!
Public Class Form1
Dim win1 As Integer = 0
Dim win2 As Integer = 0
Dim i As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str As Integer
Dim rand As New Random()
str =rand.Next(3)'随机数
If str = 0 Then
RadioButton0.Checked = True
ElseIf str = 1 Then
RadioButton1.Checked = True
ElseIf str = 2 Then
RadioButton2.Checked = True
End If
If RadioButton3.Checked = True Then
i = 0
ElseIf RadioButton4.Checked = True Then
i = 1
ElseIf RadioButton5.Checked = True Then
i = 2
Else
MsgBox("请选择要出的拳法!")
End If
If (str = 0 And i = 1) Or (str = 1 And i = 2) Or (str = 2 And i = 0) Then
win1 += 1
TextBox1.Text = "玩家胜利"
ElseIf (str = 0 And i = 2) Or (str = 1 And i = 0) Or (str = 2 And i = 1) Then
win2 += 1
TextBox1.Text = "电脑胜利"
Else
TextBox1.Text = "平手"
End If'判断胜利者
TextBox2.Text = win1
TextBox3.Text = win2
If win1 = 5 Then
MsgBox("最终胜利者是玩家!恭喜!")
win1 = 0
win2 = 0
For i = 0 To Me.Controls.Count - 1
If TypeOf (Me.Controls(i)) Is TextBox Then
Me.Controls(i).Text = ""
End If'清空过时信息
Next
ElseIf win2 = 5 Then
MsgBox("最终胜利者是电脑!")
win1 = 0
win2 = 0
For i = 0 To Me.Controls.Count - 1
If TypeOf (Me.Controls(i)) Is TextBox Then
Me.Controls(i).Text = ""
End If'清空过时信息
Next
End If
End Sub
End Class
纯属新手,高手毋笑!
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式