坐等求助!怎样用VB输出一个“*”字符构成的菱形?
3个回答
展开全部
For i = 1 To 5'上半部分行数
For j = 6 - i To 1 Step -1
Print " ";
Next j
For j = 1 To 2 * i - 1
Print "*";
Next j
Print
Next i
For i = 1 To 4'下半部分行数
For j = 1 To i + 1
Print " ";
Next j
For j = 1 To 9 - 2 * i
Print "*";
Next j
Print
Next i
For j = 6 - i To 1 Step -1
Print " ";
Next j
For j = 1 To 2 * i - 1
Print "*";
Next j
Next i
For i = 1 To 4'下半部分行数
For j = 1 To i + 1
Print " ";
Next j
For j = 1 To 9 - 2 * i
Print "*";
Next j
Next i
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Cls
a = 5: b = -1
For i = 1 To 4
a = a - 1: b = b + 2
Print Space(a);
For j = 1 To 7
If j > b Then Exit For
Print "*";
Next j
Print vbCrLf
Next i
For i = 3 To 1 Step -1
a = a + 1: b = b - 2
Print Space(a);
For j = 1 To 7
If j > b Then Exit For
Print "*";
Next j
Print vbCrLf
Next i
End Sub
Cls
a = 5: b = -1
For i = 1 To 4
a = a - 1: b = b + 2
Print Space(a);
For j = 1 To 7
If j > b Then Exit For
Print "*";
Next j
Print vbCrLf
Next i
For i = 3 To 1 Step -1
a = a + 1: b = b - 2
Print Space(a);
For j = 1 To 7
If j > b Then Exit For
Print "*";
Next j
Print vbCrLf
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询