在VB里利用循环嵌套结构,实现九九乘法表。 5
里面有4个按扭,分别为显示九九乘法表为:矩形显示command1_click,正三角显示command2_click,倒立三角显示command3_click,和清屏co...
里面有4个按扭,分别为显示九九乘法表为:矩形显示command1_click,正三角显示command2_click,倒立三角显示command3_click,和清屏command4_click。并且要在label1中显示。
哪个高手快点指点一下该怎么做???
ZHRX - 大魔法师 九级:谢谢你!你给的跟我所要的答案差不多,不多我想要的九九乘法是:(矩形一直排九个过去)
1×1=1 1×2=2 1×3=3……这样子的。你能再帮我想一下吗???谢谢了 展开
哪个高手快点指点一下该怎么做???
ZHRX - 大魔法师 九级:谢谢你!你给的跟我所要的答案差不多,不多我想要的九九乘法是:(矩形一直排九个过去)
1×1=1 1×2=2 1×3=3……这样子的。你能再帮我想一下吗???谢谢了 展开
3个回答
展开全部
Dim X(1 To 9, 1 To 9)
Private Sub Command1_Click()
For I = 0 To 8
Label1(I).Caption = ""
Next I
For I = 1 To 9
Label1(0).Caption = Label1(0).Caption & " " & vbNewLine
For J = 1 To 9
If X(I, J) < 10 Then
Label1(0).Caption = Label1(0).Caption & " " & " " & X(I, J)
Else
Label1(0).Caption = Label1(0).Caption & " " & X(I, J)
End If
Next J
Next I
End Sub
Private Sub Command2_Click()
For I = 0 To 8
Label1(I).Caption = ""
Next I
For I = 1 To 9
Label1(0).Caption = Label1(0).Caption & " " & vbNewLine
For J = 1 To I
If X(I, J) < 10 Then
Label1(0).Caption = Label1(0).Caption & " " & " " & X(I, J)
Else
Label1(0).Caption = Label1(0).Caption & " " & X(I, J)
End If
Next J
Next I
End Sub
Private Sub Command3_Click()
For I = 0 To 8
Label1(I).Caption = ""
Next I
For I = 9 To 1 Step -1
Label1(0).Caption = Label1(0).Caption & " " & vbNewLine
For J = 1 To I
If X(I, J) < 10 Then
Label1(0).Caption = Label1(0).Caption & " " & " " & X(I, J)
Else
Label1(0).Caption = Label1(0).Caption & " " & X(I, J)
End If
Next J
Next I
End Sub
Private Sub Command4_Click()
For I = 0 To 8
Label1(I).Caption = ""
Next I
End Sub
Private Sub Form_Load()
Command1.Caption = "矩 阵 显 示"
Command2.Caption = "正三角显示"
Command3.Caption = "倒三角显示"
Command4.Caption = "清 除"
For I = 1 To 9
For J = 1 To 9
X(I, J) = I * J
Next J
Next I
End Sub
Private Sub Command1_Click()
For I = 0 To 8
Label1(I).Caption = ""
Next I
For I = 1 To 9
Label1(0).Caption = Label1(0).Caption & " " & vbNewLine
For J = 1 To 9
If X(I, J) < 10 Then
Label1(0).Caption = Label1(0).Caption & " " & " " & X(I, J)
Else
Label1(0).Caption = Label1(0).Caption & " " & X(I, J)
End If
Next J
Next I
End Sub
Private Sub Command2_Click()
For I = 0 To 8
Label1(I).Caption = ""
Next I
For I = 1 To 9
Label1(0).Caption = Label1(0).Caption & " " & vbNewLine
For J = 1 To I
If X(I, J) < 10 Then
Label1(0).Caption = Label1(0).Caption & " " & " " & X(I, J)
Else
Label1(0).Caption = Label1(0).Caption & " " & X(I, J)
End If
Next J
Next I
End Sub
Private Sub Command3_Click()
For I = 0 To 8
Label1(I).Caption = ""
Next I
For I = 9 To 1 Step -1
Label1(0).Caption = Label1(0).Caption & " " & vbNewLine
For J = 1 To I
If X(I, J) < 10 Then
Label1(0).Caption = Label1(0).Caption & " " & " " & X(I, J)
Else
Label1(0).Caption = Label1(0).Caption & " " & X(I, J)
End If
Next J
Next I
End Sub
Private Sub Command4_Click()
For I = 0 To 8
Label1(I).Caption = ""
Next I
End Sub
Private Sub Form_Load()
Command1.Caption = "矩 阵 显 示"
Command2.Caption = "正三角显示"
Command3.Caption = "倒三角显示"
Command4.Caption = "清 除"
For I = 1 To 9
For J = 1 To 9
X(I, J) = I * J
Next J
Next I
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Form_Load()
Show
FontSize = 15
Print Tab(20); "九九乘法表"
Dim i As Integer
Dim j As Integer
Print
Print " *";
For i = 1 To 9
Print Tab(i * 6); i;
Next
For i = 1 To 9
Print
Print i; " ";
For j = i To 9
Print Tab(j * 6); i * j; " ";
Next j
Next i
End Sub
Show
FontSize = 15
Print Tab(20); "九九乘法表"
Dim i As Integer
Dim j As Integer
Print " *";
For i = 1 To 9
Print Tab(i * 6); i;
Next
For i = 1 To 9
Print i; " ";
For j = i To 9
Print Tab(j * 6); i * j; " ";
Next j
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不太理解你的意思 自己参考一下下面网页上的第三个问题吧
http://zhidao.baidu.com/question/25709682.html
http://zhidao.baidu.com/question/25709682.html
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询