VERSION 5.00
Begin VB.Form Form1
Caption = "p135-5"
ClientHeight = 4875
ClientLeft = 60
ClientTop = 450
ClientWidth = 8025
LinkTopic = "Form1"
ScaleHeight = 4875
ScaleWidth = 8025
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text5
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 6
Top = 3960
Width = 2775
End
Begin VB.TextBox Text4
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 5
Top = 3240
Width = 2775
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 4
Top = 2160
Width = 2775
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 3
Top = 1440
Width = 2775
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 2
Top = 720
Width = 2775
End
Begin VB.CommandButton Command2
Caption = "roots"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6360
TabIndex = 1
Top = 3480
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "end"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6360
TabIndex = 0
Top = 4080
Width = 1215
End
Begin VB.Label lbl
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5040
TabIndex = 12
Top = 840
Width = 2535
End
Begin VB.Label Label5
Alignment = 2 'Center
Caption = "root2"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 11
Top = 3960
Width = 855
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "root1:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 10
Top = 3240
Width = 855
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "c:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 9
Top = 2280
Width = 855
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "b:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 8
Top = 1560
Width = 855
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "a:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 7
Top = 840
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()
End
End Sub
Private Sub Command2_Click()
Dim a, b, c, r1, r2, delta As Single
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
If a = 0 Then
lbl.Caption = "( a )is wrong!"
Exit Sub
End If
delta = b ^ 2 - 4 * a * c
If delta < 0 Then lbl.Caption = " No Roots"
If delta = 0 Then
lbl.Caption = " One Root"
r1 = -b / (2 * a)
Text1.Text = Str(r1)
Text2.Text = Str(r1)
End If
If delta > 0 Then
r1 = (-b + Sqr(delta)) / (2 * a)
r2 = (-b + -Sqr(delta)) / (2 * a)
Text4.Text = Str(r1)
Text5.Text = Str(r2)
lbl.Caption = " Two Roots"
End If
End Sub