原始碼: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

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 讓地獄深紅的天亮 的頭像
    讓地獄深紅的天亮

    !壞人必需做好事!

    讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()