使用VB循环语句分别输出下列图形 10
1个回答
展开全部
最难的是第一个图形,代码如下:
Private Sub Form_Load()
Form1.Show
Dim Att As String
For i = 0 To 8
Att = String(i * 2 + 1, "*")
Print Space(9 - i) & Att
Next
For i = 8 To 1 Step -1
Att = String(i * 2 - 1, "*")
Print Space(10 - i) & Att
Next
End Sub
Form1.Show
Dim Att As String
For i = 0 To 8
Att = String(i * 2 + 1, "*")
Print Space(9 - i) & Att
Next
For i = 9 To 0 Step -1
Att = String(i * 2 + 1, "*")
Print Space(9 - i) & Att
Next
第二个图形
Private Sub Form_Load()
Form1.Show
Dim Att As String
For i = 0 To 8
Att = String(i * 2 + 1, "*")
Print Space(9 - i) & Att
Next
End Sub
第三个图形
Private Sub Form_Load()
Form1.Show
Dim Att As String
For i = 0 To 9
Print String(10, "*")
Next
End Sub
第四个图形
Private Sub Form_Load()
Form1.Show
Dim Att As String
For i = 0 To 8
Print String(i + 8, "*")
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询