编写VB程序,实现矩阵转置,即将一个nⅹm的矩阵的行和列互换。例如:A矩阵及其转置矩阵B
编写VB程序,实现矩阵转置,即将一个nⅹm的矩阵的行和列互换。例如:A矩阵及其转置矩阵B分别为:A=[123456]B=[142536]...
编写VB程序,实现矩阵转置,即将一个nⅹm的矩阵的行和列互换。例如:A矩阵及其转置矩阵B分别为:
A=[1 2 3
4 5 6]
B= [1 4
2 5
36 ] 展开
A=[1 2 3
4 5 6]
B= [1 4
2 5
36 ] 展开
1个回答
展开全部
Private Sub Command1_Click()
Dim a(4, 2) As Integer, b(2, 4) As Integer
Dim i As Integer, j As Integer
Dim tmp1 As String, tmp2 As String
Randomize Timer
For i = 0 To 4
For j = 0 To 2
a(i, j) = Int(Rnd * 10)
tmp1 = tmp1 & Str(a(i, j))
Next
tmp1 = tmp1 & vbCrLf
Next
For i = 0 To 2
For j = 0 To 4
b(i, j) = a(j, i)
tmp2 = tmp2 & Str(b(i, j))
Next
tmp2 = tmp2 & vbCrLf
Next
Print "原随机矩阵为:"
Print tmp1
Print "转置后矩阵为:"
Print tmp2
End Sub
追问
亲,可以告诉我你的额QQ吗
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询