早教吧 育儿知识 作业答案 考试题库 百科 知识分享

帮我写出求个行数组之和跟对角线2(即右上往左下数)我用VB6.0编的PrivateSubFormClick()DimMat(4,4)AsIntegerDimN,MAsIntegerN=4M=4Fori=1ToNForj=1ToMMat(i,j)=InputBox("请输入数据")NextjNextiPrint

题目详情
帮我写出求个行数组之和 跟 对角线2(即右上往左下数)
我用VB6.0编的
Private Sub Form_Click()
Dim Mat(4,4) As Integer
Dim N,M As Integer
N = 4
M = 4
For i = 1 To N
For j = 1 To M
Mat(i,j) = InputBox("请输入数据")
Next j
Next i
Print
Print "输入的数据为:"
Print
For i = 1 To N
For j = 1 To M
Print Tab(6 * j); Mat(i,j);
Next j
Print
Next i
Print
Print "第一行各数的和为:"
Print "第二行各数的和为:"
Print "第三行各数的和为:"
Print "第四行各数的和为:"
Print
Print "对角线1上的数据为:"
Print
For i = 1 To N
For j = 1 To M
If i = j Then
Print Tab(6 * j); Mat(i,j);
End If
Next j
Next i
Print
Print "对角线2上的数据为:"
End Sub
帮我把
Print "第一行各数的和为:"
Print "第二行各数的和为:"
Print "第三行各数的和为:"
Print "第四行各数的和为:"

Print "对角线2上的数据为:"
补上就好了...
▼优质解答
答案和解析
Private Sub Form_Click() Dim Mat(4,4) As Integer Dim N,M As Integer N = 4 M = 4 For i = 1 To N For j = 1 To M Mat(i,j) = InputBox("请输入数据") Next j Next i Print Print "输入的数据为:" Print For i = ...