实现上述功能的VB程序如下:
Private Sub Command1_Click()
List1.Clear
Dim five(1 To 5) As Integer
Dim i As Integer, j As Integer, k As Integer
Dim p As Integer, find_pair As Boolean
'随机抽取5张牌,将牌的点数存储在数组five中,并在List1中显示。代码略
i = 5: p = 1: find_pair = False
Do While i>= 2
j=p
Do While j <= i - 1
If five(j) > five(j + 1) Then
t = five(j): five(j) = five(j + 1): five(j + 1) = t
ElseIf five(j) = five(j + 1) And Not find_pair Then
t = five(1): five(1) = five(j): five(j) = t
t = five(2): five(2) = five(j + 1): five(j + 1) = t
find_pair = True
i = i + 1
p = _____________
Exit Do
End If
j = j + 1
Loop
i = i - 1
Loop
k = 0
For i = 3 To 4
If Then k = k + 1
Next i
If five(1) = five(2) And k = 2 Then
Label1.Caption = "运气不错:)"
Else
Label1.Caption = "运气一般:|"
End If
End Sub
请回答下列问题: