miércoles, 12 de noviembre de 2008

Codigo para calcular ecuacion ax2+bx+c

Dim b As Double
Dim c As Double
Dim x1 As Double
Dim x2 As Double
Dim a As Double
Dim res As Double


Private Sub Command1_Click()
If a < 0 Then
a = a * -1
b = b * -1
c = c * -1
If b * b - 4 * a * c > 0 Then
x1 = (-b + Sqr(b * b - 4 * a * c)) / (2 * a)
x2 = (-b - Sqr(b * b - 4 * a * c)) / (2 * a)

Text4.Text = x1
Text5.Text = x2
Else
MsgBox ("Los valores no son validos")

End If
ElseIf b * b - 4 * a * c > 0 Then
x1 = (-b + Sqr(b * b - 4 * a * c)) / (2 * a)
x2 = (-b - Sqr(b * b - 4 * a * c)) / (2 * a)

Text4.Text = x1
Text5.Text = x2
Else
MsgBox ("Escriba bien los valores")
End If

End Sub

Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text1.SetFocus
a = 0
b = 0
c = 0

End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Text1_Change()
If Text1.Text <> " " Then
a = Val(Text1.Text)
End If
End Sub

Private Sub Text2_Change()
If Text2.Text <> " " Then
b = Val(Text2.Text)
End If
End Sub

Private Sub Text3_Change()
If Text3.Text <> " " Then
c = Val(Text3.Text)
End If
End Sub

5 comentarios:

thepimp dijo...

Hola megustaria que me eviara los codigo y fuente de tu calculadora de ecuacion si puede me lo puede enviar a mi correo thepimpsex@live.com

Unknown dijo...

hola si me puedes mandar la fuente de tu codigo y fuente de tu programa mi correo es valiantsluis@hotmail.com

Unknown dijo...

Hola...me puedes ayudar con un codigo en visual para resolver inecuaciones lineales
Gracias

Unknown dijo...

Hola me puedes ayudar con un código.para resolver Polinomio de.segundo grado

Unknown dijo...

Me podrías ayudar con un código para resolver ecuaciones ya sea con método de sustitución, igualación o eliminación, con cualquiera de los 3 métodos, el programa tiene que mostrar los procedimientos paso por paso en visual studio
Mi correo es lezlyperez63@gmail.com