用VB熟悉两重循环结构的写法.根据输入的行数打印空心菱形,求大神代码
1个回答
展开全部
Private Sub Command1_Click()
Dim N As Integer
Dim I As Integer, J As Integer
Cls
N = Val(Text1.Text)
For I = 1 To N
Print Tab(N - I + 1);
For J = 2 * I - 1 To 1 Step -1
If J = 2 * I - 1 Or J = 1 Then
Print "*";
Else
Print " ";
End If
Next
Next
For I = 1 To N
Print Tab(I);
For J = 2 * (N - I) + 1 To 1 Step -1
If J = 2 * (N - I) Or J = 1 Then
Print "*";
Else
Print " ";
End If
Next
Next
End Sub
已经运行过,有什么问题请留言。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询