编写程序,使用双循环输出下列三角形:
                A B C D E 
                A B C D 
                A B C  
                A B
                A
----------------------
用双循环,怎么做啊,希望大家指点

解决方案 »

  1.   

    '复制如下代码运行OK
    Option ExplicitPrivate Sub Command1_Click()
        Call DrawAlphabits(5)
    End SubPrivate Function DrawAlphabits(ByVal nLevel As Integer)
        '其中nLevel是你想显示层数
        Dim i As Integer, j As Integer
        Dim strLine As String
        
        Const c_ASCStart = 64
        Const c_Splitter = vbTab '字符间分隔符
        For i = nLevel To 1 Step -1
            strLine = ""
            For j = 1 To i
                strLine = strLine & c_Splitter & Chr$(c_ASCStart + j)
            Next j
            Print strLine
        Next i
    End Function