?? form1.frm
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6090
ClientLeft = 60
ClientTop = 450
ClientWidth = 7605
LinkTopic = "Form1"
ScaleHeight = 6090
ScaleWidth = 7605
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Height = 495
Left = 2640
TabIndex = 9
Top = 3000
Width = 1455
End
Begin VB.TextBox Text2
Height = 495
Left = 2640
TabIndex = 7
Top = 1800
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "退出"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 5520
TabIndex = 5
Top = 4440
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "下一次計算"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 3120
TabIndex = 4
Top = 4440
Width = 1335
End
Begin VB.PictureBox Picture1
Height = 3135
Left = 4440
ScaleHeight = 3075
ScaleWidth = 2475
TabIndex = 3
Top = 480
Width = 2535
End
Begin VB.TextBox Text1
Height = 495
Left = 2640
TabIndex = 1
Top = 480
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "輸入矩陣"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 840
TabIndex = 0
Top = 4440
Width = 1455
End
Begin VB.Label Label3
Caption = "最大迭代次數"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 8
Top = 3120
Width = 1575
End
Begin VB.Label Label2
Caption = "輸入容許誤差"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 6
Top = 1920
Width = 1935
End
Begin VB.Label Label1
Caption = "請輸入方陣的維數"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 2
Top = 600
Width = 1935
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!(), b!(), x!(), y!(), n1%, n%, k%, ep!, e!, s!, i%, j%
n = Val(Text1.Text)
ReDim a(n, n), b(n), x(n), y(n)
For i = 1 To n
For j = 1 To n
a(i, j) = InputBox("請輸入a(" & i & "," & j & "):", "練習")
Next j
b(i) = InputBox("請輸入b(" & i & "):", "練習")
Next i
ep = Val(Text2.Text) '容許誤差
n1 = Val(Text3.Text) '輸入迭代次數
For i = 1 To n
x(i) = 0
Next i
k = 0
Do '迭代格式
k = k + 1
For i = 1 To n
s = 0
For j = 1 To n
If i <> j Then
s = s + a(i, j) * x(j)
End If
Next j
y(i) = (b(i) - s) / a(i, i)
Next i
e = 0
For i = 1 To n
If Abs(y(i) - x(i)) > e Then
e = Abs(y(i) - x(i))
End If
Next i
If e < ep Then
For i = 1 To n
Picture1.Print "x("; j; i; ")="; y(i)
Next i
Exit Sub
Else
For i = 1 To n
x(i) = y(i)
Next i
End If
Loop Until k = n1
Picture1.Print "失敗"
End Sub
Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
End Sub
Private Sub Command3_Click()
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -