刚学不久...都不知道这样行不行,老师就提了下怎么实现矩阵的乘法
for i=1 to 3
for j=1 to 3
for n=1 to 3
sum(i,j)=sum(i,j)+A(i,n)*B(n,j)
next
next
next
下面是我的代码,想请大家帮忙看下错在哪里,改怎么改,麻烦了~~~
Private Sub cmd407_Click()
Dim tx1407() As Double
Dim tx2407() As Double
Dim tx3407() As Double
Dim i As Integer
Dim j As Integer
Dim n As Integer
For i = 1 To 3
For j = 1 To 3
For n = 1 To 3
tx3407(i, j) = tx3407(i, j) + tx1407(i, n) * tx2407(n, j)
Next
Next
Next
End Sub
Private Sub tx3407_Change(Index As Integer)
tx3407(0).Text = tx3407(1, 1)
tx3407(1).Text = tx3407(1, 2)
tx3407(2).Text = tx3407(1, 3)
tx3407(3).Text = tx3407(2, 1)
tx3407(4).Text = tx3407(2, 2)
tx3407(5).Text = tx3407(2, 3)
tx3407(6).Text = tx3407(3, 1)
tx3407(7).Text = tx3407(3, 2)
tx3407(8).Text = tx3407(3, 3)
End Sub
for i=1 to 3
for j=1 to 3
for n=1 to 3
sum(i,j)=sum(i,j)+A(i,n)*B(n,j)
next
next
next
下面是我的代码,想请大家帮忙看下错在哪里,改怎么改,麻烦了~~~
Private Sub cmd407_Click()
Dim tx1407() As Double
Dim tx2407() As Double
Dim tx3407() As Double
Dim i As Integer
Dim j As Integer
Dim n As Integer
For i = 1 To 3
For j = 1 To 3
For n = 1 To 3
tx3407(i, j) = tx3407(i, j) + tx1407(i, n) * tx2407(n, j)
Next
Next
Next
End Sub
Private Sub tx3407_Change(Index As Integer)
tx3407(0).Text = tx3407(1, 1)
tx3407(1).Text = tx3407(1, 2)
tx3407(2).Text = tx3407(1, 3)
tx3407(3).Text = tx3407(2, 1)
tx3407(4).Text = tx3407(2, 2)
tx3407(5).Text = tx3407(2, 3)
tx3407(6).Text = tx3407(3, 1)
tx3407(7).Text = tx3407(3, 2)
tx3407(8).Text = tx3407(3, 3)
End Sub