首頁>Club>
7
回覆列表
  • 1 # 智慧戴娜8s4

    1、具體實現星號三角形的程式碼如下:

    Public Function sanjiaoxing(ByVal num As Integer) As String

    Dim i, j As Integer

    Dim st As String

    st = ""

    Dim m As Integer

    If (num Mod 2 = 0) Then

    sanjiaoxing = ""

    End If

    '輸出上三角形

    For i = 1 To (num + 1) \ 2

    For j = 1 To (num + 1) / 2 - i

    st = st & " "

    Next

    For j = 1 To 2 * i - 1

    st = st & "*"

    Next

    st = st & vbCrLf

    Next

    sanjiaoxing = st

    End Function

    Private Sub Form_Click()

    Print sanjiaoxing(11)

    End Sub

  • 中秋節和大豐收的關聯?
  • OPPO手機如何開啟指紋下載?