作业是用Visual Studio做个21点游戏,不会写程序求大神帮忙(代码是一开始的,不会编下去了,文档里有要求,求帮忙)
Public Class Form1Dim 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)