2009年1月7日 星期三

4取3組合

Module Module1

    Sub Main()
        Dim a1() As String = {"A", "B", "C", "D"}
        Dim i = 0
        For Each elem1 In a1
            For Each elem2 In a1
                For Each elem3 In a1
                    If elem1 < elem2 And elem2 < elem3 Then
                        i = i + 1
                        Console.WriteLine(i & ":" & elem1 & elem2 & elem3)
                    End If
                Next
            Next
        Next
        Console.Read()
    End Sub

End Module

 

image

沒有留言:

張貼留言