如何用VB编程输出字母金字塔
如何用VB循环语句编写输入行数输出由字母组成的三角形如N=5输出ABBBCCCCCDDDDDDDEEEEEEEEEE...
如何用VB循环语句编写输入行数 输出由字母组成的三角形 如 N=5 输出 A BBB CCCCC DDDDDDD EEEEEEEEEE
展开
3个回答
展开全部
用空散散神格来显示不是字母的,然后按变量显示对应掘和的数量的字母即可。
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim n As Integer
n = 7
For i = 1 To n
Print Space$(n - i);
For j = 冲亏1 To (i * 2 - 1)
Print Chr(64 + i);
Next j
Next i
For i = n - 1 To 1 Step -1
Print Space$(n - i);
For j = 1 To i
Print Chr(64 + i); Space$(1);
Next j
Next i
End Sub
2013-04-20
展开全部
Private Sub Command1_Click()Dim I As Integer, J As Integer
For I = 1 To 5
For J = 1 To 6 - I
Print " ";
Next
For J = 1 To 2 * I - 1
Print Chr(64 + I);
Next
Print
Next
End Sub
For I = 1 To 5
For J = 1 To 6 - I
Print " ";
Next
For J = 1 To 2 * I - 1
Print Chr(64 + I);
Next
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-04-20
展开全部
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim n As Integer
n = 7
For i = 1 To n
Print Space$(n - i);
For j = 1 To (i * 2 - 1)
Print Chr(64 + i);
Next j
Print
Next i
For i = n - 1 To 1 Step -1
Print Space$(n - i);
For j = 1 To i
Print Chr(64 + i); Space$(1);
Next j
Print
Next i
End Sub
Dim i As Integer
Dim j As Integer
Dim n As Integer
n = 7
For i = 1 To n
Print Space$(n - i);
For j = 1 To (i * 2 - 1)
Print Chr(64 + i);
Next j
Next i
For i = n - 1 To 1 Step -1
Print Space$(n - i);
For j = 1 To i
Print Chr(64 + i); Space$(1);
Next j
Next i
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询