practice6_18.frm
来自「深圳大学的vb上机与教学的课件」· FRM 代码 · 共 102 行
FRM
102 行
VERSION 5.00
Begin VB.Form Form1
Caption = "用二分法求方程的根"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.Label Label3
BorderStyle = 1 'Fixed Single
Caption = "单击此处开始计算"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 735
Left = 120
TabIndex = 3
Top = 1680
Width = 4455
End
Begin VB.OLE OLE1
BackStyle = 0 'Transparent
BorderStyle = 0 'None
Class = "Equation.3"
Height = 495
Left = 1560
OleObjectBlob = "practice6_18.frx":0000
SizeMode = 1 'Stretch
TabIndex = 2
Top = 120
Width = 2055
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "求方程"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 600
TabIndex = 1
Top = 240
Width = 945
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "在区间(1,4)内的实根"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 600
TabIndex = 0
Top = 720
Width = 3480
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Label3_Click()
a = 1
b = 4
n = 0
f1 = a ^ 3 + 4 * a ^ 2 - 10
Do While b - a > 0.00001
x = (a + b) / 2
f = x ^ 3 + 4 * x ^ 2 - 10
If f1 * f > 0 Then
a = x
Else
b = x
End If
Loop
Label3.Caption = "方程的根为:" & Format(x, "0.0000")
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?