VB中怎么编数字金字塔
7个回答
展开全部
Private Sub Form_Click()
Dim i As Integer, j As Integer
For i = 1 To 9
If i <= 5 Then
Print Space(5 - i);
For j = 1 To (i - 1) * 2 + 1
If j = (i - 1) * 2 + 1 Then
Print CStr(i)
Else
Print CStr(i);
End If
Next j
Else
Print Space(i - 5);
For j = 1 To (10 - i - 1) * 2 + 1
If j = (10 - i - 1) * 2 + 1 Then
Print CStr(i)
Else
Print CStr(i);
End If
Next j
End If
Next i
'点击窗口任意位置即可
End Sub
Dim i As Integer, j As Integer
For i = 1 To 9
If i <= 5 Then
Print Space(5 - i);
For j = 1 To (i - 1) * 2 + 1
If j = (i - 1) * 2 + 1 Then
Print CStr(i)
Else
Print CStr(i);
End If
Next j
Else
Print Space(i - 5);
For j = 1 To (10 - i - 1) * 2 + 1
If j = (10 - i - 1) * 2 + 1 Then
Print CStr(i)
Else
Print CStr(i);
End If
Next j
End If
Next i
'点击窗口任意位置即可
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
--
2022-12-05 广告
2022-12-05 广告
图形化编程简单理解为用积木块形式编程,scratch和python也是其中的一种,属于入门级编程,以其简单生动的画面获得无数学生的喜爱,深圳市创客火科技有限公司是一家做教育无人机的公司,旗下有编程无人机,积木无人机及室内外编队,每款飞机含有...
点击进入详情页
本回答由--提供
展开全部
for i= 1 to 9
print space( abs(5-i) );
for j=1 to (2* (5-abs(5-i)) -1)
print cstr(i);
next
print
next
print space( abs(5-i) );
for j=1 to (2* (5-abs(5-i)) -1)
print cstr(i);
next
next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
for i= 1 to 9
print space( abs(5-i) );
for j=1 to (2* (5-abs(5-i)) -1)
print cstr(i);
next
print
next
print space( abs(5-i) );
for j=1 to (2* (5-abs(5-i)) -1)
print cstr(i);
next
next
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2012-05-03
展开全部
代码如下
Private Sub Command1_Click()
Dim a(1 To 9)
For i = 1 To 9:
Print Tab(30 - 3 * i);
For j = 1 To i:
Print j; m;
Next
Print ;
Next
For n = 1 To 8
Print Tab(30);
For m = n To 1 Step -1
Print m;
Next
Print
Next
End Sub
Private Sub Command1_Click()
Dim a(1 To 9)
For i = 1 To 9:
Print Tab(30 - 3 * i);
For j = 1 To i:
Print j; m;
Next
Print ;
Next
For n = 1 To 8
Print Tab(30);
For m = n To 1 Step -1
Print m;
Next
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim i As Byte, j As Byte, n As Byte
Do
n = InputBox("n=", "请输入n的值")
Loop While n < 1 Or n > 9
For i = 1 To n
Print Space(Abs(5 - i));
For j = 1 To (2 * (5 - Abs(5 - i)) - 1)
Print CStr(i);
Next j
Next i
End Sub
Dim i As Byte, j As Byte, n As Byte
Do
n = InputBox("n=", "请输入n的值")
Loop While n < 1 Or n > 9
For i = 1 To n
Print Space(Abs(5 - i));
For j = 1 To (2 * (5 - Abs(5 - i)) - 1)
Print CStr(i);
Next j
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询