求用VB编6行杨辉三角,狂谢!
求用VB编6行杨辉三角,狂谢!我这样写为什么总是错?PrivateSubForm_Click()Dima(6,11)AsIntegerFori=1To6Forj=1To1...
求用VB编6行杨辉三角,狂谢!
我这样写为什么总是错?
Private Sub Form_Click()
Dim a(6, 11) As Integer
For i = 1 To 6
For j = 1 To 11
If i + j = 1 Or i - j = 5 Then
a(i, j) = 1
Next j
Next i
For i = 3 To 6
Print Tab((7 - i));
For j = 1 To 2 * i - 3
a(i, j) = a(i - 1, j - 1) + a(i - 1, j + 1)
Next j
Next i
For i = 1 To 6
For j = 1 To 11
Print a(i, j);
Next j
Print
Next i
End Sub
不好意思!!第五行好像应该是IF i=j=7 or i - j = 5,打错了 展开
我这样写为什么总是错?
Private Sub Form_Click()
Dim a(6, 11) As Integer
For i = 1 To 6
For j = 1 To 11
If i + j = 1 Or i - j = 5 Then
a(i, j) = 1
Next j
Next i
For i = 3 To 6
Print Tab((7 - i));
For j = 1 To 2 * i - 3
a(i, j) = a(i - 1, j - 1) + a(i - 1, j + 1)
Next j
Next i
For i = 1 To 6
For j = 1 To 11
Print a(i, j);
Next j
Next i
End Sub
不好意思!!第五行好像应该是IF i=j=7 or i - j = 5,打错了 展开
展开全部
Private Sub Command1_Click()
Dim a(1 To 6, 1 To 6)
For i = 1 To 6
For j = 1 To i
If j = 1 Or j = i Then
a(i, j) = 1
Else
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
End If
Next j
Next i
For i = 1 To 6
Print Spc((6 - i) * 3);
For j = 1 To 6
Print Spc(3); a(i, j);
Next j
Print
Next i
End Sub
我把下面的该了应该是a(1 to 6,1 to 6)二维数组
Dim a(1 To 6, 1 To 6)
For i = 1 To 6
For j = 1 To i
If j = 1 Or j = i Then
a(i, j) = 1
Else
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
End If
Next j
Next i
For i = 1 To 6
Print Spc((6 - i) * 3);
For j = 1 To 6
Print Spc(3); a(i, j);
Next j
Next i
End Sub
我把下面的该了应该是a(1 to 6,1 to 6)二维数组
展开全部
Private Sub Command1_Click()
Dim a(1 to 6)
For i = 1 To 6
For j = 1 To i
If j = 1 Or j = i Then
a(i, j) = 1
Else
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
End If
Next j
Next i
For i = 1 To 6
Print Spc((6 - i) * 3);
For j = 1 To 6
Print Spc(3); a(i, j);
Next j
Print
Next i
End Sub
Dim a(1 to 6)
For i = 1 To 6
For j = 1 To i
If j = 1 Or j = i Then
a(i, j) = 1
Else
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
End If
Next j
Next i
For i = 1 To 6
Print Spc((6 - i) * 3);
For j = 1 To 6
Print Spc(3); a(i, j);
Next j
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim a(6, 11) As Integer
For i = 1 To 6
For j = 1 To i
If j = 1 Or j = i Then
a(i, j) = 1
Else
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
End If
Next
Next
For i = 1 To 6
Print Spc((6 - i) * 3);
For j = 1 To 6
Print Spc(3); a(i, j);
Next
Print
Next
End Sub
Dim a(6, 11) As Integer
For i = 1 To 6
For j = 1 To i
If j = 1 Or j = i Then
a(i, j) = 1
Else
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
End If
Next
Next
For i = 1 To 6
Print Spc((6 - i) * 3);
For j = 1 To 6
Print Spc(3); a(i, j);
Next
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询