VB怎么打印出一个中空的菱形
1个回答
展开全部
Private Sub Command1_Click()
Form1.Cls
Dim i As Integer, n As Integer
Dim j As Integer
For i = 1 To 9
Print Tab(20 - i);
For j = 1 To 2 * i - 1
If j = 1 Or j = 2 * i - 1 Then
Print "*";
Else
Print " ";
End If
Next
Print
Next
n = i - 2
For i = n To 1 Step -1
Print Tab(20 - i);
For j = 1 To 2 * i - 1
If j = 1 Or j = 2 * i - 1 Then
Print "*";
Else
Print " ";
End If
Next
Print
Next
End Sub
Form1.Cls
Dim i As Integer, n As Integer
Dim j As Integer
For i = 1 To 9
Print Tab(20 - i);
For j = 1 To 2 * i - 1
If j = 1 Or j = 2 * i - 1 Then
Print "*";
Else
Print " ";
End If
Next
Next
n = i - 2
For i = n To 1 Step -1
Print Tab(20 - i);
For j = 1 To 2 * i - 1
If j = 1 Or j = 2 * i - 1 Then
Print "*";
Else
Print " ";
End If
Next
Next
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询