VB题:如何利用for循环打出可以利用text文档控制大小的星号菱形?
1个回答
展开全部
Private Sub Command1_Click()
Open "d:\0.txt" For Input As #1
Dim n As Integer
Input #1, n
For i = 1 To n
For j = 1 To n - i
Print " ";
Next j
For j = 1 To 2 * i - 1
Print "*";
Next j
Next i
For i = n - 1 To 1 Step -1
For j = 1 To n - i
Print " ";
Next j
For j = 1 To 2 * i - 1
Print "*";
Next j
Next i
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询