Neler yeni

ikinci dereceden denklem çözer

Genc_Beyin

Administrator
Yönetici
Katılım
5 Eyl 2022
Mesajlar
1,977
Tepkime puanı
0
Puanları
36
Web sitesi
www.webgezginler.com
Public Class Form1

Inherits System.Windows.Forms.Form



#Region " Windows Form Designer generated code "



Public Sub New()

MyBase.New()



'sis Call Is required by se Windows Form Designer.

InitializeComponent()



'Add any initialization after se InitializeComponent() Call



End Sub



'Form overrides dispose To clean up se component list.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing sen

If Not (components Is Nosing) sen

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub



'Required by se Windows Form Designer

Private components As System.ComponentModel.IContainer



'NOTE: se following procedure Is required by se Windows Form Designer

'It can be modified using se Windows Form Designer.

'Do Not modify it using se code editor.

Friend WisEvents TextBox1 As System.Windows.Forms.TextBox

Friend WisEvents TextBox2 As System.Windows.Forms.TextBox

Friend WisEvents TextBox3 As System.Windows.Forms.TextBox

Friend WisEvents Label1 As System.Windows.Forms.Label

Friend WisEvents Label2 As System.Windows.Forms.Label

Friend WisEvents Label3 As System.Windows.Forms.Label

Friend WisEvents Button1 As System.Windows.Forms.Button

Friend WisEvents Label4 As System.Windows.Forms.Label

Friend WisEvents Label5 As System.Windows.Forms.Label

Friend WisEvents Label6 As System.Windows.Forms.Label

Friend WisEvents Label7 As System.Windows.Forms.Label

Friend WisEvents Label8 As System.Windows.Forms.Label

Friend WisEvents Label9 As System.Windows.Forms.Label

Friend WisEvents Label10 As System.Windows.Forms.Label

Friend WisEvents Label11 As System.Windows.Forms.Label

Private Sub InitializeComponent()

Me.TextBox1 = New System.Windows.Forms.TextBox

Me.TextBox2 = New System.Windows.Forms.TextBox

Me.TextBox3 = New System.Windows.Forms.TextBox

Me.Label1 = New System.Windows.Forms.Label

Me.Label2 = New System.Windows.Forms.Label

Me.Label3 = New System.Windows.Forms.Label

Me.Button1 = New System.Windows.Forms.Button

Me.Label4 = New System.Windows.Forms.Label

Me.Label5 = New System.Windows.Forms.Label

Me.Label6 = New System.Windows.Forms.Label

Me.Label7 = New System.Windows.Forms.Label

Me.Label8 = New System.Windows.Forms.Label

Me.Label9 = New System.Windows.Forms.Label

Me.Label10 = New System.Windows.Forms.Label

Me.Label11 = New System.Windows.Forms.Label

Me.SuspendLayout()

'

'TextBox1

'

Me.TextBox1.BackColor = System.Drawing.Color.IndianRed

Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.TextBox1.Location = New System.Drawing.Point(40, 24)

Me.TextBox1.Name = "TextBox1"

Me.TextBox1.Size = New System.Drawing.Size(40, 13)

Me.TextBox1.TabIndex = 0

Me.TextBox1.Text = "a"

'

'TextBox2

'

Me.TextBox2.BackColor = System.Drawing.Color.IndianRed

Me.TextBox2.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.TextBox2.Location = New System.Drawing.Point(112, 24)

Me.TextBox2.Name = "TextBox2"

Me.TextBox2.Size = New System.Drawing.Size(40, 13)

Me.TextBox2.TabIndex = 1

Me.TextBox2.Text = "b"

'

'TextBox3

'

Me.TextBox3.BackColor = System.Drawing.Color.IndianRed

Me.TextBox3.BorderStyle = System.Windows.Forms.BorderStyle.None

Me.TextBox3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.TextBox3.Location = New System.Drawing.Point(160, 24)

Me.TextBox3.Name = "TextBox3"

Me.TextBox3.Size = New System.Drawing.Size(40, 13)

Me.TextBox3.TabIndex = 2

Me.TextBox3.Text = "c"

'

'Label1

'

Me.Label1.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label1.Location = New System.Drawing.Point(56, 16)

Me.Label1.Name = "Label1"

Me.Label1.Size = New System.Drawing.Size(56, 24)

Me.Label1.TabIndex = 3

Me.Label1.Text = "x^2 +"

'

'Label2

'

Me.Label2.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label2.Location = New System.Drawing.Point(128, 16)

Me.Label2.Name = "Label2"

Me.Label2.Size = New System.Drawing.Size(32, 23)

Me.Label2.TabIndex = 4

Me.Label2.Text = "x +"

'

'Label3

'

Me.Label3.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label3.Location = New System.Drawing.Point(200, 16)

Me.Label3.Name = "Label3"

Me.Label3.Size = New System.Drawing.Size(32, 23)

Me.Label3.TabIndex = 5

Me.Label3.Text = "=0"

'

'Button1

'

Me.Button1.Location = New System.Drawing.Point(248, 16)

Me.Button1.Name = "Button1"

Me.Button1.TabIndex = 6

Me.Button1.Text = "Coz Ulan"

'

'Label4

'

Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label4.Location = New System.Drawing.Point(104, 72)

Me.Label4.Name = "Label4"

Me.Label4.Size = New System.Drawing.Size(100, 16)

Me.Label4.TabIndex = 7

Me.Label4.Text = "Label4"

'

'Label5

'

Me.Label5.Location = New System.Drawing.Point(104, 88)

Me.Label5.Name = "Label5"

Me.Label5.TabIndex = 8

Me.Label5.Text = "Label5"

'

'Label6

'

Me.Label6.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Me.Label6.Location = New System.Drawing.Point(280, 72)

Me.Label6.Name = "Label6"

Me.Label6.Size = New System.Drawing.Size(100, 16)

Me.Label6.TabIndex = 9

Me.Label6.Text = "Label6"

'

'Label7

'

Me.Label7.Location = New System.Drawing.Point(280, 88)

Me.Label7.Name = "Label7"

Me.Label7.TabIndex = 10

Me.Label7.Text = "Label7"

'

'Label8

'

Me.Label8.Location = New System.Drawing.Point(56, 72)

Me.Label8.Name = "Label8"

Me.Label8.Size = New System.Drawing.Size(40, 23)

Me.Label8.TabIndex = 11

Me.Label8.Text = "1. Kok"

'

'Label9

'

Me.Label9.Location = New System.Drawing.Point(232, 72)

Me.Label9.Name = "Label9"

Me.Label9.Size = New System.Drawing.Size(40, 23)

Me.Label9.TabIndex = 12

Me.Label9.Text = "2. Kok"

'

'Label10

'

Me.Label10.Location = New System.Drawing.Point(64, 128)

Me.Label10.Name = "Label10"

Me.Label10.TabIndex = 13

Me.Label10.Text = "Label10"

'

'Label11

'

Me.Label11.Location = New System.Drawing.Point(240, 128)

Me.Label11.Name = "Label11"

Me.Label11.TabIndex = 14

Me.Label11.Text = "Label11"

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.BackColor = System.Drawing.Color.IndianRed

Me.ClientSize = New System.Drawing.Size(560, 266)

Me.Controls.Add(Me.Label11)

Me.Controls.Add(Me.Label10)

Me.Controls.Add(Me.Label9)

Me.Controls.Add(Me.Label8)

Me.Controls.Add(Me.Label7)

Me.Controls.Add(Me.Label6)

Me.Controls.Add(Me.Label5)

Me.Controls.Add(Me.Label4)

Me.Controls.Add(Me.Button1)

Me.Controls.Add(Me.Label3)

Me.Controls.Add(Me.Label2)

Me.Controls.Add(Me.Label1)

Me.Controls.Add(Me.TextBox3)

Me.Controls.Add(Me.TextBox2)

Me.Controls.Add(Me.TextBox1)

Me.ForeColor = System.Drawing.Color.White

Me.Name = "Form1"

Me.Text = "Ikinci dereceden denklem cozuyom oleeeey"

Me.ResumeLayout(False)



End Sub



#End Region



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim a, b, c, d, f, x, x1, x2, diskriminant As Long

a = TextBox1.Text

b = TextBox2.Text

c = TextBox3.Text

If a = "" sen

a = 1

ElseIf b = "" sen

b = 1

ElseIf c = "" sen

c = 1

End If

diskriminant = b ^ 2 - (4 * a * c)

If diskriminant < 0 sen

InputBox("Bu denklemin reel koku yok")

GoTo seson

ElseIf diskriminant = 0 sen

InputBox("Bu denklemin iki esit koku var")

GoTo esitikikok

ElseIf diskriminant > 0 sen

InputBox("Bu denklemin iki koku var")

GoTo ikikok

End If

esitikikok:

d = -1 * b

f = Mas.Sqrt(diskriminant)

x = (d + f) / (2 * a)

Label10.Text = x

Label11.Text = x

Label4.Text = (b & " + kok " & diskriminant)

Label5.Text = 2 * a

Label6.Text = (b & " - kok " & diskriminant)

Label7.Text = Label5.Text

GoTo seson

ikikok:

x1 = (d + f) / (2 * a)

x2 = (d - f) / (2 * a)

Label10.Text = x1

Label11.Text = x2

Label4.Text = (b & " + kok " & diskriminant)

Label5.Text = 2 * a

Label6.Text = (b & " - kok " & diskriminant)

Label7.Text = Label5.Text

seson:

InputBox("Islem yapildi")

End Sub

End Class
 
Üst Alt