VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Calculadora cuadratica con resultados reales y complejos.

by Daniel Gonz¨lez Amat (1 Submission)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 9th March 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Calculadora cuadratica con resultados reales y complejos.

Rate Calculadora cuadratica con resultados reales y complejos.



' NOMBRES: Daniel González, Cristian Grao
Option Explicit ' especifica que todas la variables deben ser declaradas
Dim a, B, C As Single 'declaracion de variables de tipo single

Private Sub Command1_Click() ' comando "limpiar"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
End Sub ' fin del private sub del comando 1

Private Sub Command2_Click()
a = Val(Text1.Text) ' las variables evaluadas
B = Val(Text2.Text)
C = Val(Text3.Text)
Dim h  As Single ' declaracion de variables
Dim i As Double
Dim T As Double
T = C / a

If a = 0 And B = 0 Then ' si a=0 y b=0 entonces....
Text4.Text = "error" 'aparece un error

End If ' fin si
If a = 0 And C = 0 Then ' si a=0 y b=0 entonces....
Text4.Text = "error" 'aparece un error
End If 'fin si
If B <> 0 Then ' si b es distinto de 0 entonces...
If a = 0 Then 'si a es igual a 0 entonces...
 Text4.Text = -C / B
  End If
  If a = 0 Then 'si a es igual a 0 entonces...
  Text5.Text = 0
  End If ' fin si
  End If 'fin si
  If a <> 0 Then ' si a es distinto de cero entonces...
If C = 0 Then 'si c es igual cero entonces...
Text4.Text = -B / a
End If 'fin si
If C = 0 Then 'si c es igual a 0 entonces...
Text5.Text = 0
  End If 'fin si
End If 'fin si


If B = 0 And T > 0 Then ' si b es igual 0 y t es mayor a 0 siendo t igual a la division de c por a
Text7.Text = -Sqr(Abs(T))
If B = 0 And T > 0 Then ' si b es igual a 0 y t mayor a 0 entonces...
Text5.Text = 0
End If 'fin si
End If 'fin si
If B = 0 And T < 0 Then 'si b es igual a 0 y t menor a 0 entonces...
Text4.Text = Sqr(Abs(T))
If B = 0 And T < 0 Then ' si b es igual a 0 y t menor a 0 entonces...
Text6.Text = 0
End If 'fin si
End If 'fin si
If B = 0 And T < 0 Then ' si b es igual a 0 y t menor a 0 entonces...
Text5.Text = -Sqr(Abs(T))
If B = 0 And T < 0 Then
Text7.Text = 0
End If
End If
If B = 0 And T > 0 Then
Text6.Text = Sqr(Abs(T))
If B = 0 And T > 0 Then
Text4.Text = 0
End If
End If


If a <> 0 And B <> 0 And C <> 0 Then 'si a distinto de 0,b distinto de 0 y c distinto de 0 entonces...

Text4.Text = -B / (2 * a)

Text5.Text = -B / (2 * a)
h = (B * B) - (4 * a * C)
i = Sqr(Abs(h))
    If h > 0 Then 'si h mayor a 0
 Text4.Text = (-B + i) / (2 * a)
End If
 If h > 0 Then 'si h es mayor a 0
 Text5.Text = (-B - i) / (2 * a)
End If

If h < 0 Then ' si h es menor a 0
 i = Sqr(-1 * h) / (2 * a)
 Else
 If (h > 0) Then i = 0 'si h mayor a 0
 End If
 Text6.Text = -i
Text7.Text = i
 End If
 
 
 

End Sub ' fin del private sub del comando 2

Private Sub Command3_Click() ' comando para salir
Unload Form1

End Sub ' fin del private sub del comando 3



Download this snippet    Add to My Saved Code

Calculadora cuadratica con resultados reales y complejos. Comments

No comments have been posted about Calculadora cuadratica con resultados reales y complejos.. Why not be the first to post a comment about Calculadora cuadratica con resultados reales y complejos..

Post your comment

Subject:
Message:
0/1000 characters