vb编程在屏幕上输出如下图形

2024-12-23 04:49:48
推荐回答(3个)
回答1:

楼上的什么啊……

Private Sub Command1_Click()
Dim i As Integer, n As Integer
n = 3
For i = 1 To n
Print Space(n - i); String(2 * i - 1, "*")
Next
For i = n - 1 To 1 Step -1
Print Space(n - i); String(2 * i - 1, "*")
Next
End Sub

回答2:

用Print来实现
Private Sub Command1_Click()
Print "*"
Print Chr(10) & " ***"
Print Chr(10) & " ****"
Print Chr(10) & " ***"
Print Chr(10) & " *"
End Sub

回答3:

Option Explicit

Private Sub Form_Load()
AutoRedraw = True
Dim i As Long, j As Long
For i = 1 To 5
j = IIf(i < 4, i, 6 - i)
Print Space(4 - j); String(j * 2 - 1, 42)
Next
End Sub

'^-^