Public Class Form1
Dim ans(19) As String
Dim str1 = ""
Dim inStr = ""
Dim ctr = 0
Sub enu(d, n, m)
Dim i As Integer
If d = n Then
For i = 0 To n - 1
str1 = str1 & ans(i) & " "
Next
str1 = str1 & vbNewLine
ctr = ctr + 1
Return
End If
For i = 1 To m
ans(d) = Mid(inStr, i, 1)
enu(d + 1, n, m)
Next
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim n, m As Integer
inStr = "ABc"
n = 3
m = Len(inStr)
enu(0, n, m)
MsgBox(str1 & vbNewLine & "共" & ctr & "個")
End
End Sub
End Class
沒有留言:
張貼留言