标题:作业是用Visual Studio做个21点游戏,不会写程序求大神帮忙(代码是一开始的 ...
只看楼主
PP_LPX
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-10-13
 问题点数:0 回复次数:0 
作业是用Visual Studio做个21点游戏,不会写程序求大神帮忙(代码是一开始的,不会编下去了,文档里有要求,求帮忙)
Public Class Form1
    Dim p(5), c(5) As Integer

    Private Sub btnPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlay.Click
        Dim t As Integer
        p(1) = Int(Rnd() * 52 + 1)
        Do
            t = Int(Rnd() * 52 + 1)
        Loop While t = p(1)
        c(1) = t
        Do
            t = Int(Rnd() * 52 + 1)
        Loop While t = p(1) Or t = c(1)
        p(2) = t
        Do
            t = Int(Rnd() * 52 + 1)
        Loop While t = p(1) Or t = c(1) Or t = p(2)
        c(2) = t
        picP1.Image = Image.FromFile("Images\" & p(1) & ".jpg")
        picC1.Image = Image.FromFile("Images\" & c(1) & ".jpg")
        picP2.Image = Image.FromFile("Images\" & p(2) & ".jpg")
        picC2.Image = Image.FromFile("Images\back.jpg")
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Randomize()
    End Sub
End Class
第一份作业.zip (253.66 KB)
搜索更多相关主题的帖子: 21点 游戏 
2015-10-13 20:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-458162-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.054446 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved