2010年11月5日 星期五

二進位列舉

'二進位列舉
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim str1 = ""
        Dim a() = {0, 1}
        Dim e1, e2, e3, e4
        For Each e4 In a
            For Each e3 In a
                For Each e2 In a
                    For Each e1 In a
                        str1 = str1 & e4 & e3 & e2 & e1 & vbNewLine
                    Next
                Next
            Next
        Next
        MsgBox(str1)
    End Sub
End Class

沒有留言: