level 13
public sub yanghui(dim value as integer)
if value < 3 then
messagebox.show("请重新输入数组大于3的值!")
else
dim arry as integer[,] = new integer[value,value]
dim s as string,z as string
for i as integer = 0 to value - 1
for j as integer = 0 to i
if i=j also j=0 then
arry(i,y) = 1
else
arry(i,y) = arry(i-1,j-1) + arry(i-1,j)
end if
s &= arry(i,j) & " "
next
z &= s & vbcrlf
next
messagebox.show("数组为:" & vbcrlf & z)
end if
end sub
2012年06月05日 15点06分
3
level 13
有几个地方没注意到。修改:
Public Sub yanghui(ByVal value As Integer)
If value < 3 Then
MessageBox.Show("请重新输入数组大于3的值!")
Else
Dim arry(value, value) As Integer
Dim s As String = "", z As String = ""
For i As Integer = 0 To value - 1
For j As Integer = 0 To i
If i = j AndAlso j = 0 Then
arry(i, j) = 1
Else
arry(i, j) = arry(i - 1, j - 1) + arry(i - 1, j)
End If
s &= arry(i, j) & " "
Next
z &= s & vbCrLf
Next
MessageBox.Show("数组为:" & vbCrLf & z)
End If
End Sub
2012年06月05日 16点06分
4