📄 方阵转置.frm
字号:
VERSION 5.00
Begin VB.Form 方阵转置
AutoRedraw = -1 'True
Caption = "方阵转置"
ClientHeight = 3825
ClientLeft = 60
ClientTop = 345
ClientWidth = 7860
BeginProperty Font
Name = "Arial Black"
Size = 21.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 3825
ScaleWidth = 7860
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdZZ
Caption = "转置"
Height = 795
Left = 2880
TabIndex = 2
Top = 120
Width = 1635
End
Begin VB.Label lblAfterRotate
BackColor = &H8000000E&
BeginProperty Font
Name = "Courier New"
Size = 15
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2535
Left = 4020
TabIndex = 4
Top = 1020
Width = 3495
End
Begin VB.Label lblOrgNum
BackColor = &H8000000E&
BeginProperty Font
Name = "Courier New"
Size = 15
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2535
Left = 300
TabIndex = 3
Top = 1020
Width = 3375
End
Begin VB.Label Label2
Caption = "转置后: "
Height = 675
Left = 4980
TabIndex = 1
Top = 180
Width = 1695
End
Begin VB.Label Label1
Caption = "转置前: "
Height = 675
Left = 600
TabIndex = 0
Top = 180
Width = 1695
End
End
Attribute VB_Name = "方阵转置"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const N As Integer = 6
Dim S(1 To N, 1 To N) As Integer
Dim st$
Private Sub zz(A() As Integer)
If UBound(A, 1) - LBound(A, 1) = UBound(A, 2) - LBound(A, 2) Then
For I = 1 To N
For J = 1 To I
T = S(I, J)
S(I, J) = S(J, I)
S(J, I) = T
Next J
Next I
Else
MsgBox "不是方阵"
End If
End Sub
Sub OutArray(A() As Integer, lbl As Label)
Dim st$
st = ""
For I = 1 To N
For J = 1 To N
st = st & Format(S(I, J), " 00")
Next J
st = st & vbNewLine & " "
Next I
lbl = st
End Sub
Private Sub cmdZZ_Click()
zz S '转置
OutArray S, lblAfterRotate '输出方阵
End Sub
Private Sub Form_Load()
For I = 1 To N: For J = 1 To N
S(I, J) = Int(Rnd() * 100)
Next J, I
OutArray S, lblOrgNum
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -