一、Private Sub Form_Click() show Dim m, n, i, j As Integer m = 4 :n = 7 For i = 1 To m For j = 1 To m - i + 1 Print " "; Next j For j = 1 To n Print "*"; Next j Print Next i Print For i = 1 To m For j = 1 To m - i + 1 Print " "; Next j For j = 1 To 2 * i - 1 Print "*"; Next j Print Next i Print For i = 1 To m For j = 1 To i Print " "; Next j For j = 1 To 2 * m - 2 * i + 1 Print "*"; Next j Print Next i End Sub 二、Sub Command1_Click() Dim i As Integer For i = 1 To 11 Step 2 For m = 11 To i Step -1 Debug.Print "*"; Next Print Chr(10) & Space(1 + i \ 2); Next End Sub
一、Private Sub Form_Click() show Dim m, n, i, j As Integer m = 4 :n = 7 For i = 1 To m For j = 1 To m - i + 1 Print " "; Next j For j = 1 To n Print "*"; Next j Print Next i Print For i = 1 To m For j = 1 To m - i + 1 Print " "; Next j For j = 1 To 2 * i - 1 Print "*"; Next j Print Next i Print For i = 1 To m For j = 1 To i Print " "; Next j For j = 1 To 2 * m - 2 * i + 1 Print "*"; Next j Print Next i End Sub 二、Sub Command1_Click() Dim i As Integer For i = 1 To 11 Step 2 For m = 11 To i Step -1 Debug.Print "*"; Next Print Chr(10) & Space(1 + i \ 2); Next End Sub