求解一元二次方程.frm
来自「上传的包含两个文件」· FRM 代码 · 共 152 行
FRM
152 行
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "Command3"
Height = 495
Left = 2880
TabIndex = 12
Top = 2400
Width = 975
End
Begin VB.CommandButton Command2
Caption = "Command2"
Height = 615
Left = 1440
TabIndex = 11
Top = 2280
Width = 975
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 615
Left = 240
TabIndex = 10
Top = 2280
Width = 855
End
Begin VB.TextBox Text5
Height = 495
Left = 3480
TabIndex = 9
Text = "Text5"
Top = 1560
Width = 855
End
Begin VB.TextBox Text4
Height = 495
Left = 1200
TabIndex = 8
Text = "Text4"
Top = 1440
Width = 855
End
Begin VB.TextBox Text3
Height = 615
Left = 3120
TabIndex = 7
Text = "Text3"
Top = 720
Width = 975
End
Begin VB.TextBox Text2
Height = 495
Left = 1440
TabIndex = 6
Text = "Text2"
Top = 720
Width = 975
End
Begin VB.TextBox Text1
Height = 495
Left = 120
TabIndex = 5
Text = "Text1"
Top = 720
Width = 975
End
Begin VB.Label Label5
Caption = "第二根"
Height = 495
Left = 2400
TabIndex = 4
Top = 1440
Width = 855
End
Begin VB.Label Label4
Caption = "第一根"
Height = 255
Left = 120
TabIndex = 3
Top = 1560
Width = 855
End
Begin VB.Label Label3
Caption = "常数项"
Height = 495
Left = 3120
TabIndex = 2
Top = 0
Width = 975
End
Begin VB.Label Label2
Caption = "一次项"
Height = 375
Left = 1440
TabIndex = 1
Top = 120
Width = 855
End
Begin VB.Label Label1
Caption = "二次项"
Height = 375
Left = 120
TabIndex = 0
Top = 120
Width = 855
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, c, d, e
Dim i As String
a = Val(Text1.Text): b = Val(Text2.Text): c = Val(Text3.Text)
If a = 0 Then MsgBox "不是二次方程": End
d = b * b - 4 * a * c
If d < 0 Then
Beep
e = Sqr(-d)
Text4.Text = -b / (2 * a) & " + " & e / (2 * a) & "i"
Text5.Text = -b / (2 * a) & "-" & e / (2 * a) & "i"
Else
e = Sqr(d)
Text4.Text = (-b + e) / (2 * a)
Text5.Text = (-b - e) / (2 * a)
End If
End Sub
Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
End Sub
Private Sub Command3_Click()
End
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?