vb编程5行“*”,第一行1个“*”,第二行3个“*”以此类推,第五行9个“*”,并使5行“*”呈等腰三角形排
编写程序,输出5行“*”,第一行1个“*”,第二行3个“*”,以此类推,第五行9个“*”,并使5行“*”呈等腰三角形排列。这个程序怎么编制?急用!帮帮忙啊亲们。...
编写程序,输出5行“*”,第一行1个“*”,第二行3个“*”,以此类推,第五行9个“*”,并使5行“*”呈等腰三角形排列。这个程序怎么编制?急用!帮帮忙啊亲们。
展开
展开全部
画一个command控件,代码如下
Private Sub Command1_Click()
Dim a As String, i As Integer, j As Integer
Dim st As String
a = "*"
st = ""
For i = 1 To 5
For j = 1 To 5 - i
st = st & " "
Next j
For j = 1 To i * 2 - 1
st = st & a & " "
Next j
st = st & Chr(13) & Chr(10)
Next i
Print st
End Sub
Private Sub Command1_Click()
Dim a As String, i As Integer, j As Integer
Dim st As String
a = "*"
st = ""
For i = 1 To 5
For j = 1 To 5 - i
st = st & " "
Next j
For j = 1 To i * 2 - 1
st = st & a & " "
Next j
st = st & Chr(13) & Chr(10)
Next i
Print st
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询