• Jueves 2 de Mayo de 2024, 00:13

Mostrar Mensajes

Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.


Temas - thanyz

Páginas: [1]
1
Visual Basic 6.0 e inferiores / Ayuda Con Codigo De Biseccion Soy Nuevo
« en: Miércoles 25 de Julio de 2007, 02:24 »
quisiera si alguien me explicara el codigo siguiente ya q no lo comprendo me lo pasaron y quiero entenderle mas el donde dice frm principal y frm biseccion no entiendo por q soy nuevo en esto de programa en vb
Option Explicit
Dim sig As String
Dim b As String
Dim a As Double
Dim aux As Double
Dim xi As Double
Dim xs As Double
Dim xr As Double
Dim fxi As Double
Dim fxs As Double
Dim fxr As Double
Dim ff As Double
Dim ea As Double
Dim correcto As Integer
Private Sub cmdcalcular_Click()
fxi = (Exp(-xi)) - xi
fxs = (Exp(-xs)) - xs
xr = (xi + xs) / 2
fxr = (Exp(-xr)) - xr
ff = fxi * fxr
Label2.Caption = Label2.Caption & vbCrLf & Format(xi, "0.#####")
Label4.Caption = Label4.Caption & vbCrLf & Format(xs, "0.#####")
If (ff > 0) Then
sig = "+"
xi = xr
ElseIf (ff < 0) Then
sig = "-"
xs = xr
End If
If (correcto > 0) Then
ea = Abs(((xr - a) / xr) * 100)
End If
Label1.Caption = Label1.Caption & vbCrLf & correcto
Label3.Caption = Label3.Caption & vbCrLf & Format(fxi, "0.#####")
Label5.Caption = Label5.Caption & vbCrLf & Format(fxs, "0.#####")
Label6.Caption = Label6.Caption & vbCrLf & Format(xr, "0.#####")
Label7.Caption = Label7.Caption & vbCrLf & Format(fxr, "0.#####")
Label8.Caption = Label8.Caption & vbCrLf & sig
Label9.Caption = Label9.Caption & vbCrLf & Format(ea, "0.####")
a = xr
If (ea < 0.01) And (correcto > 0) Then
frmbiseccion.Visible = False
cmdcalcular.Enabled = False
frmprincipal.Visible = False
MsgBox "Raiz Encontrada en Xr=" & xr, vbExclamation, "kA 8/OCT/2001 "
frmbiseccion.Visible = True *** explicacion de esto porfa ***

End If
correcto = correcto + 1
End Sub
Private Sub cmdsalir_Click()
Unload Me
frmprincipal.Visible = True
End Sub


Private Sub Command1_Click()
Label1.Caption = " I"
Label2.Caption = " xi"
Label3.Caption = " f(xi)"
Label4.Caption = " xs"

Label5.Caption = " f(xs)"
Label6.Caption = " xr"
Label7.Caption = " f(xr)"
Label8.Caption = " f(xi) f(xr)"
Label9.Caption = " Ea %"
correcto = 0
cmdcalcular.Enabled = True
xi = 0
xs = 1
End Sub
Private Sub Form_Load()
xi = 0
xs = 1
ea = 0
correcto = 0
frmprincipal.Visible = False
End Sub

2
Visual Basic para principiantes / Ayuda Con Codigo De Biseccion Soy Nuevo
« en: Miércoles 25 de Julio de 2007, 02:21 »
quisiera si alguien me explicara el codigo siguiente ya q no lo comprendo me lo pasaron y quiero entenderle mas el donde dice frm principal y frm biseccion no entiendo por q soy nuevo en esto de programa en vb
Option Explicit
Dim sig As String
Dim b As String
Dim a As Double
Dim aux As Double
Dim xi As Double
Dim xs As Double
Dim xr As Double
Dim fxi As Double
Dim fxs As Double
Dim fxr As Double
Dim ff As Double
Dim ea As Double
Dim correcto As Integer
Private Sub cmdcalcular_Click()
fxi = (Exp(-xi)) - xi
fxs = (Exp(-xs)) - xs
xr = (xi + xs) / 2
fxr = (Exp(-xr)) - xr
ff = fxi * fxr
Label2.Caption = Label2.Caption & vbCrLf & Format(xi, "0.#####")
Label4.Caption = Label4.Caption & vbCrLf & Format(xs, "0.#####")
If (ff > 0) Then
sig = "+"
xi = xr
ElseIf (ff < 0) Then
sig = "-"
xs = xr
End If
If (correcto > 0) Then
ea = Abs(((xr - a) / xr) * 100)
End If
Label1.Caption = Label1.Caption & vbCrLf & correcto
Label3.Caption = Label3.Caption & vbCrLf & Format(fxi, "0.#####")
Label5.Caption = Label5.Caption & vbCrLf & Format(fxs, "0.#####")
Label6.Caption = Label6.Caption & vbCrLf & Format(xr, "0.#####")
Label7.Caption = Label7.Caption & vbCrLf & Format(fxr, "0.#####")
Label8.Caption = Label8.Caption & vbCrLf & sig
Label9.Caption = Label9.Caption & vbCrLf & Format(ea, "0.####")
a = xr
If (ea < 0.01) And (correcto > 0) Then
frmbiseccion.Visible = False
cmdcalcular.Enabled = False
frmprincipal.Visible = False
MsgBox "Raiz Encontrada en Xr=" & xr, vbExclamation, "kA 8/OCT/2001 "
frmbiseccion.Visible = True *** explicacion de esto porfa ***

End If
correcto = correcto + 1
End Sub
Private Sub cmdsalir_Click()
Unload Me
frmprincipal.Visible = True
End Sub


Private Sub Command1_Click()
Label1.Caption = " I"
Label2.Caption = " xi"
Label3.Caption = " f(xi)"
Label4.Caption = " xs"

Label5.Caption = " f(xs)"
Label6.Caption = " xr"
Label7.Caption = " f(xr)"
Label8.Caption = " f(xi) f(xr)"
Label9.Caption = " Ea %"
correcto = 0
cmdcalcular.Enabled = True
xi = 0
xs = 1
End Sub
Private Sub Form_Load()
xi = 0
xs = 1
ea = 0
correcto = 0
frmprincipal.Visible = False
End Sub

Páginas: [1]