原始碼:http://down.gogobox.com.tw/t2329175/uq2m2
Private Sub Command1_Click()
P1.Cls
P1.Visible = True
P1.Print " 計算中"
DoEvents
Dim Tmp As String
Tmp = "{}" & vbCrLf
Dim a() As String, b As String
Dim Num As Integer, i As Long
a() = Split(TIn, " ")
Num = UBound(a) + 1
For i = 1 To 2 ^ Num - 1
b = Bin(i)
For j = 1 To Len(b)
If Mid(b, Len(b) + 1 - j, 1) = "1" Then
Tmp = Tmp & "{" & a(j - 1) & "}"
End If
Next
DoEvents
Tmp = Tmp & vbCrLf
Next
Tout.Text = Tmp
P1.Visible = False
End Sub
Public Function Bin(ByVal a As Long) As String
Bin = ""
Do While a > 0
c = a Mod 2
a = a \ 2
Bin = Str(c) & Bin
Loop
Bin = Replace(Bin, " ", "")
End Function
全站熱搜
留言列表