5-12.frm
来自「本教材为“第2章”、“第4章”、“第7章”、“第8章”、“第10章”和“第12章」· FRM 代码 · 共 90 行
FRM
90 行
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3780
ClientLeft = 60
ClientTop = 405
ClientWidth = 8010
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 3780
ScaleWidth = 8010
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "构造并输出"
Height = 495
Left = 840
TabIndex = 4
Top = 2760
Width = 1935
End
Begin VB.TextBox Text2
Height = 1695
Left = 4320
MultiLine = -1 'True
TabIndex = 3
Top = 720
Width = 3495
End
Begin VB.TextBox Text1
Height = 1695
Left = 240
MultiLine = -1 'True
TabIndex = 2
Top = 720
Width = 3495
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "转置矩阵:"
Height = 315
Left = 4560
TabIndex = 1
Top = 360
Width = 1575
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "矩阵A:"
Height = 315
Left = 480
TabIndex = 0
Top = 360
Width = 960
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim a(1 To 4, 1 To 4) As Integer
Dim i As Integer, j As Integer, t As Integer
Text1.Text = "": Text2.Text = ""
For i = 1 To 4
For j = 1 To 4
a(i, j) = (i - 1) * 4 + j
Text1.Text = Text1.Text & Format(a(i, j), "@@@@")
Next j
Text1.Text = Text1.Text & vbCrLf
Next i
For i = 1 To 4
For j = 1 To 4
If j > i Then
t = a(i, j): a(i, j) = a(j, i): a(j, i) = t
End If
Text2.Text = Text2.Text & Format(a(i, j), "@@@@")
Next j
Text2.Text = Text2.Text & vbCrLf
Next i
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?