求VB程序设计,五行五列矩阵中副对角线之和Sub Fun(X() As Integer,N As Integer,s As Integer)'End SubPrivate Sub Command1_Click()N = Val(InputBox("请输入矩阵的行数N","数据输入",5))ReDim X(N,N)Form1.ClsRandomizeFor i = 1 To NF
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 21:20:15
求VB程序设计,五行五列矩阵中副对角线之和Sub Fun(X() As Integer,N As Integer,s As Integer)'End SubPrivate Sub Command1_Click()N = Val(InputBox("请输入矩阵的行数N","数据输入",5))ReDim X(N,N)Form1.ClsRandomizeFor i = 1 To NF
求VB程序设计,五行五列矩阵中副对角线之和
Sub Fun(X() As Integer,N As Integer,s As Integer)
'
End Sub
Private Sub Command1_Click()
N = Val(InputBox("请输入矩阵的行数N","数据输入",5))
ReDim X(N,N)
Form1.Cls
Randomize
For i = 1 To N
For j = 1 To N
X(i,j) = Int(Rnd * 91) + 10
Print X(i,j);
Next j
Print
Next i
End Sub
Private Sub Command2_Click()
Dim s As Integer
Call Fun(X,N,s)
Print "副对角线元素之和为:" & s
SaveData
End Sub
求VB程序设计,五行五列矩阵中副对角线之和Sub Fun(X() As Integer,N As Integer,s As Integer)'End SubPrivate Sub Command1_Click()N = Val(InputBox("请输入矩阵的行数N","数据输入",5))ReDim X(N,N)Form1.ClsRandomizeFor i = 1 To NF
Dim i As Integer
For i = 1 To N
s = s + x(i, N - i + 1)
Next i
如果程序能正常运行,你得在最前面加上公用变量定义:
Dim x() As Integer
Dim N As Integer
Call Fun(X, N, s)改成
Call Fun(X(), N, s)