Dim i As Integer, j As Integer
For i = 1 To 4
Print Space(3 * (4 - i))
For j = 1 To i
Print j
Next
For j = i - 1 To 1 Step -1
Print j
Next
Next
For i = 3 To 1 Step -1
Print Space(3 * (4 - i))
For j = 1 To i
Print j
Next
For j = i - 1 To 1 Step -1
Print j
Next
Next
End Sub
已经运行过。有什么问题请留言。
好久没写VB啦
好怀念,
先创建一个from把autoRedraw设置为True
然后贴入以下代码
Private Sub Form_Load()Dim Length As Integer
Dim Width As Integer
Dim i As Integer
Dim j As Integer
Dim Space As String
Dim Ascii As Integer
Dim Str As String
Ascii = 65
Width = 1
Space = ""
Length = InputBox("输入长度:")
For i = 1 To Length
Space = Space & " "
Next
For i = 1 To Length
Str = ""
For j = 1 To Width
Str = Str & Chr(Ascii)
Next
Print Space & Str
If i < Length Then
Space = Mid(Space, 1, Len(Space) - 1)
Ascii = Ascii + 1
Width = Width + 2
End If
Next
For i = 1 To Length
Space = Space & " "
Ascii = Ascii - 1
Width = Width - 2
Str = ""
For j = 1 To Width
Str = Str & Chr(Ascii)
Next
Print Space & Str
Next
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)