将3*3的矩阵转置我编了个程序Private Sub Form_click()Dim a(1 To 3,1 To 3),i As Byte,j As Byte,t As ByteFor i = 1 To 3For j = 1 To 3a(i,j) = Val(InputBox("a(" & i & "," & j & ")=?"))Next jNext iFor i = 2 To 3For j = 1 To i - 1t = a(i,j):
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/17 14:29:38
将3*3的矩阵转置我编了个程序Private Sub Form_click()Dim a(1 To 3,1 To 3),i As Byte,j As Byte,t As ByteFor i = 1 To 3For j = 1 To 3a(i,j) = Val(InputBox("a(" & i & "," & j & ")=?"))Next jNext iFor i = 2 To 3For j = 1 To i - 1t = a(i,j):
将3*3的矩阵转置我编了个程序
Private Sub Form_click()
Dim a(1 To 3,1 To 3),i As Byte,j As Byte,t As Byte
For i = 1 To 3
For j = 1 To 3
a(i,j) = Val(InputBox("a(" & i & "," & j & ")=?"))
Next j
Next i
For i = 2 To 3
For j = 1 To i - 1
t = a(i,j):a(i,j) = a(j,i):a(j,i) = t
Next j
Next i
For i = 1 To 3
For j = 1 To 3
Print a(j,i);
Next j
Print
Next i
End Sub
为什么输出的还是原来的矩阵,没有转置呢?
将3*3的矩阵转置我编了个程序Private Sub Form_click()Dim a(1 To 3,1 To 3),i As Byte,j As Byte,t As ByteFor i = 1 To 3For j = 1 To 3a(i,j) = Val(InputBox("a(" & i & "," & j & ")=?"))Next jNext iFor i = 2 To 3For j = 1 To i - 1t = a(i,j):
因为你输出时又转置了一下……
For i = 1 To 3
For j = 1 To 3
Print a(j,i);'