Algo parecido a este !!! ayuda

gamba123 1 Publicaciones viernes, 27 de octubre de 2017Fecha de inscripción viernes, 27 de octubre de 2017 Última intervención - 27 oct 2017 a las 14:05
Option Explicit
Dim a() As Double
Dim b() As Double
Dim F, C As Integer
Dim s As String
Dim cadena As String


Public Sub ecuacion()
Dim n, m, p As Integer
Dim i, j As Integer
s = ""
n = F
m = C
For p = 1 To n
For j = p + 1 To m
a(p, j) = a(p, j) / a(p, p)
Next j
For i = 1 To n
If i <> p Then
For j = p + 1 To m
a(i, j) = a(i, j) - a(i, p) * a(p, j)
Next j
End If
Next i
Next p
For j = 1 To n
s = s & "X" & j & "=" & Round(a(j, m), 2) & vbCrLf
Next j

End Sub
Public Sub Llenado()
Dim i, j As Integer
ReDim a(F, C)
ReDim b(F, C)
For i = 1 To F
For j = 1 To C
If j <> C Then
a(i, j) = Val(InputBox("X" & j & ": ", "ECUACION" & i & ":"))
Else
a(i, j) = Val(InputBox(" = ? ", "ECUACION" & i & ":"))
End If
b(i, j) = a(i, j)
Next j
Next i
End Sub
Public Sub Mostrar()
Dim i, j As Integer
For i = 1 To F
For j = 1 To C
If j <> C Then
If a(i, j) >= 0 Then
cadena = cadena & "+" & a(i, j) & "X" & j & " "
Else
cadena = cadena & "-" & a(i, j) * (-1) & "X" & j & " "
End If
Else
cadena = cadena & "=" & a(i, j) & " "
End If
Next j
cadena = cadena & vbCrLf
cadena = cadena & vbCrLf
Next i
End Sub
Public Sub Modificar()
Dim num, j, i, k As Integer
For i = 1 To F
For k = 1 To C
a(i, k) = b(i, k)
Next k
Next i
num = Val(InputBox("¿cual ecuacion modificara?", "MODIFICAR"))
If num <= F Then
For j = 1 To C
If j <> C Then
a(num, j) = Val(InputBox("X" & j & " : ", "ECUACION" & num & ":"))
Else
a(num, j) = Val(InputBox(" = ?", "ECUACION" & num & ":"))
End If
Next j
Else
End If


End Sub



Private Sub CMCALCULAR_Click()
If F > 0 Then
ecuacion
resultados.Caption = s
Else
MsgBox ("INTRODUZCA ECUACIONES")
End If

End Sub

Private Sub CMLIMPIAR_Click()
F = 0
C = 0
cadena = ""
s = ""
resultados.Caption = ""
ecuaciones.Caption = ""

End Sub

Private Sub CMLLENAR_Click()
F = Val(InputBox("cantidad de incognitas", "DATOS"))
C = F + 1
Llenado
Mostrar
ecuaciones.Caption = cadena
End Sub

Private Sub CMMODIFICAR_Click()
If F > 0 Then
Modificar
cadena = ""
Mostrar
ecuaciones.Caption = cadena
Else
MsgBox "no existe ecuaciones"
End If
End Sub

Private Sub CMSALIR_Click()
End
End Sub

Private Sub Frame3_Click()

End Sub

Private Sub UserForm_Click()

End Sub
Ver más