vb 二维数组赋值
发布网友
发布时间:2023-10-20 22:53
我来回答
共2个回答
热心网友
时间:2024-11-23 02:00
Public Class Form1
Dim m1%(,), x%, y%, t%, n%
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Name = Val(InputBox("请输入n的值:"))
m1(1, 1) = 1
Label1.Text = m1(1, 1) & vbCrLf
For x = 2 To n
m1(i,1)=1: m1(i,i)=1
For y = 2 To i-1
m1(i,j) = m1(i - 1,y - 1) + m1(i - 1, j)
Label1.Text &= m1(x, y) & " "
Next
Label1.Text &= vbCrLf
Next
End Sub
End Class
热心网友
时间:2024-11-23 02:00
针对第二段,没仔细研究 似乎Redim(n,n) 你试试, 还有 把 m1(0, 0) = 1 : m1(1, 0) = 1 : m1(1, 1) = 1 放到redim 的下面 不然可能要重新赋值