Private Sub Command1_Click() Dim a(54) As Integer For i = 1 To 54 a(i) = i Next For i = 53 To 1 Step -1 a = Int(Rnd * (i + 1)) + 1 t = a(i + 1) a(i + 1) = a(n) a(n) = t Next
End Sub
Private Sub Command1_Click() Dim a(54) As Integer Dim temp As String For i = 1 To 54 a(i) = i Next Me.Cls For i = 53 To 1 Step -1 '原来是a = Int(Rnd * (i + 1)) + 1,改成下面的 n = Int(Rnd * (i + 1)) + 1 t = a(i + 1) a(i + 1) = a(n) a(n) = t Next
For i = 1 To 54 temp = temp & a(i) & vbTab If i Mod 4 = 0 Then Print temp temp = "" End If Next End Sub
Private Sub Command1_Click() Dim a(54) As Integer '定义一个数组 Dim temp As String '定义一个字符串 For i = 1 To 54 '原来的牌是从1到54排好的 a(i) = i Next Me.Cls '这里用cls干什么???????????? For i = 53 To 1 Step -1 '循环53次,, '原来是a = Int(Rnd * (i + 1)) + 1,改成下面的 n = Int(Rnd * (i + 1)) + 1 '抽出53张牌 t = a(i + 1) '定义t为a(i + 1) a(i + 1) = a(n) '把随机抽的牌放到a(t+1)处,这么说对吗??????? a(n) = t '原来的位置上的牌,再放到a(n)处,相当于交换.??????? Next
For i = 1 To 54 temp = temp & a(i) & vbTab '不太懂???????能讲解一下吗,我很笨! If i Mod 4 = 0 Then '不太懂???????能讲解一下吗,我很笨! Print temp '不太懂???????能讲解一下吗,我很笨! temp = "" '不太懂???????能讲解一下吗,我很笨! End If Next End Sub