vb编程 For结构的*排列倒三角形怎么弄啊 求高手赐教啊
用循环语句编写程序,当单击“产生随机数”按钮后,将自动产生一个1~10之间的随机整数n,当单击“绘出图形1”按钮后,根据该随机整数n在窗体上绘出一个n行n列的矩形数字图形...
用循环语句编写程序,当单击“产生随机数”按钮后,将自动产生一个1~10之间的随机整数n,当单击“绘出图形1”按钮后,根据该随机整数n在窗体上绘出一个n行n列的矩形数字图形。当单击“绘出图形2”按钮后,根据该随机整数n在窗体上绘出一个n行n列的直角三角形数字图形。当单击“绘出图形3”按钮后,根据该随机整数n在窗体上绘出一个n行n列倒直角三角形数字图形。当单击“清屏”按钮时清除窗体上绘出的数字图形,当按“结束”按钮时结束程序运行。
这个是随机数,已经对了
Private Sub Command4_Click()
Text1.Text = Int(Rnd * 10) + 1
第一个对了
正方形
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To Val(Text1.Text)
Print "*";
For j = 1 To Val(Text1.Text)
Print "*";
Next j
Print
Next i
End Sub
但是另外两个三角形
一个
*
**
***
****
*****
******
另一个是
*****
****
***
**
*
求高手指教 O(∩_∩)O谢谢 展开
这个是随机数,已经对了
Private Sub Command4_Click()
Text1.Text = Int(Rnd * 10) + 1
第一个对了
正方形
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To Val(Text1.Text)
Print "*";
For j = 1 To Val(Text1.Text)
Print "*";
Next j
Next i
End Sub
但是另外两个三角形
一个
*
**
***
****
*****
******
另一个是
*****
****
***
**
*
求高手指教 O(∩_∩)O谢谢 展开
1个回答
展开全部
rem 三角形
Private Sub Command2_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To Val(Text1.Text)
Print "*";
For j = 1 To i
Print "*";
Next j
Print
Next i
End Sub
rem 倒三角:
Private Sub Command3_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To Val(Text1.Text)
Print "*";
For j = Val(Text1.Text) to i step -1
Print "*";
Next j
Print
Next i
End Sub
Private Sub Command2_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To Val(Text1.Text)
Print "*";
For j = 1 To i
Print "*";
Next j
Next i
End Sub
rem 倒三角:
Private Sub Command3_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To Val(Text1.Text)
Print "*";
For j = Val(Text1.Text) to i step -1
Print "*";
Next j
Next i
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询