Option Explicit
Dim ss As String '最终生成的字符串
Dim tt As Integer '生成结果的个数
Private Sub Command1_Click()
Dim i As Integer, j As Integer, m As Integer, n As Integer
Cls '清屏
tt = 0
Print "-----------------------------------"
For i = 1 To 4
For j = 1 To 4
For m = 1 To 4
For n = 1 To 4
If i + j + m + n = 10 And i <> j And i <> m And i <> n And j <> m And j <> n And m <> n Then
ss = sort(i) & sort(j) & sort(m) & sort(n)
tt = tt + 1
Print ss
End If
Next
Next
Next
Next
Print "----------------------------------"
Print "对于A(4,4),一共有"; tt; "种方法"
Print "----------------------------------"
End Sub
Public Function sort(x As Integer) As String
Dim i As Integer
Dim s As String
For i = 1 To x
s = Chr(64 + x) '获取这个字母 ,字母A的ASCII码为65
Next
sort = s '返回这个字母,以A开始的字母
End Function
Private Sub Command2_Click()
Form2.Show
End Sub
'要把FORM1的AutoRecorddraw设为真