跑求用VB编写一道题

来源:百度知道 编辑:UC知道 时间:2024/07/12 14:11:25
用VB6.0把下面这个图编写出来~!~~

*
***
*****
*******
*****
***
*

for i= 1 to 4
? tab(5-i);string(2*i-1,"*")
next i
for i=3 to 1 step-1
? tab(5-i);string(2*i-1,"*")
next i

Private Sub form_click()
For i = 1 To 7
Print String(7 - (Abs(8 - 2 * i)), "*")
Next i
End Sub

for i=1 to 7
for j=1 to 7 step 2
form1.write "*"
next
form1.writeln
next

这个代码比较简单吧。
For i = 1 To 7
Print Switch(i < 5, String(i * 2 - 1, "*"), i > 4, String(15 - 2 * i, "*"))
Next