vb.net中怎么快速齐全矩阵转置
发布网友
发布时间:2022-04-19 17:27
我来回答
共1个回答
热心网友
时间:2023-08-29 13:08
Option Explicit
Option Base 1
Dim a(4, 4) As Integer
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Picture1.Cls
Randomize
For i = 1 To 4
For j = 1 To 4
a(i, j) = Int(Rnd * 9) + 1
Picture1.Print a(i, j);
Next j
Picture1.Print
Next i
End Sub
Private Sub Command2_Click()
Dim i As Integer, j As Integer
Dim b(4, 4) As Integer
Picture2.Cls
For i = 1 To 4
For j = 1 To 4
b(i, j) = a(j, i)
Picture2.Print b(i, j);
Next j
Picture2.Print
Next i
End Sub
Private Sub Command3_Click()
Dim i As Integer, j As Integer, temp As Integer
Picture2.Cls
For i = 1 To 4
For j = i To 4
temp = a(i, j)
a(i, j) = a(j, i)
a(j, i) = temp
Next j
Next i
For i = 1 To 4
For j = 1 To 4
Picture2.Print a(i, j);
Next j
Picture2.Print
Next i
End Sub