Dim a(), b(), g(), i As Integer, j As Integer, x As Integer, y As Integer
Dim c As Integer, d As Integer, m As Integer, n As Integer, p As Integer, q As Integer, Temp As Integer, str1 As String, str2 As String
Private Sub Command1_Click()
c = Val(InputBox("输入矩阵行数", "提示"))
d = Val(InputBox("输入矩阵列数", "提示"))
ReDim a(1 To c, 1 To d)
For i = 1 To c
For j = 1 To d
str1 = "输入矩阵的" & i & "行" & j & "列元素"
a(i, j) = Val(InputBox(str1, "提示"))
Next j
Next i
Print
Print Tab(3); "矩阵A的各元素:";
For i = 1 To c
For j = 1 To d
Print Tab(j * 3); a(i, j);
Next j
Print
Next i
End Sub
Private Sub Command2_Click()
m = Val(InputBox("输入矩阵行数", "提示"))
n = Val(InputBox("输入矩阵列数", "提示"))
ReDim b(1 To m, 1 To n)
For x = 1 To m
For y = 1 To n
str2 = "输入矩阵的" & x & "行" & y & "列元素"
b(x, y) = Val(InputBox(str2, "提示"))
Next y
Next x
Print
Print Tab(3); "矩阵B的各元素:";
For x = 1 To m
For y = 1 To n
Print Tab(y * 3); b(x, y);
Next y
Print
Next x
End Sub
Private Sub Command3_Click()
For i = 1 To c
For y = 1 To n
Temp = 0
For j = 1 To d
For x = 1 To m
Temp = Temp + a(i, j) * b(x, y)
Next x
Next j
Print Tab(3); "计算结果:"
g(i, y) = Temp
Print Tab(y * 3); g(i, y);
Next y
Print
Next i
End Sub
各位高手帮忙看看哪出毛病了。。。