📄 习题7.frm
字号:
VERSION 5.00
Begin VB.Form FRM6_5_3
BackColor = &H00FF8080&
Caption = "6-5-3:数组实例3--矩阵操作"
ClientHeight = 5835
ClientLeft = 375
ClientTop = 960
ClientWidth = 8640
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 5835
ScaleWidth = 8640
Begin VB.CommandButton Command2
Caption = "输出矩阵"
Height = 495
Left = 840
TabIndex = 3
Top = 3000
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "建立矩阵"
Height = 495
Left = 840
TabIndex = 2
Top = 1800
Width = 1695
End
Begin VB.PictureBox Picture1
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3255
Left = 2760
ScaleHeight = 3195
ScaleWidth = 4995
TabIndex = 1
Top = 1200
Width = 5055
End
Begin VB.Label Label2
BackColor = &H0080FFFF&
Caption = "问题:1、如何表达对角线上的元素? 2、如何按规定的行、列输出?"
ForeColor = &H00FF0000&
Height = 855
Left = 1680
TabIndex = 4
Top = 4680
Width = 6135
End
Begin VB.Label Label1
BackColor = &H000000FF&
Caption = "编写程序,建立并输出一个10*10的矩阵,该矩阵对角线元素为1,其余元素均为0"
ForeColor = &H0000FF00&
Height = 855
Left = 840
TabIndex = 0
Top = 120
Width = 6975
End
End
Attribute VB_Name = "FRM6_5_3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 1
Dim a(10, 10)
Private Sub Command1_Click()
For i = 1 To 10
For j = 1 To 10
If i = j Or i + j = 11 Then
a(i, j) = 1
Else
a(i, j) = 0
End If
Next j
Next i
MsgBox ("矩阵已建立,请输出")
End Sub
Private Sub Command2_Click()
For i = 1 To 10
For j = 1 To 10
If i = j Or i + j = 11 Then
a(i, j) = 1
Else
a(i, j) = 0
End If
Picture1.Print a(i, j);
Next j
Picture1.Print
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -