Calculadora en operaciones de Vectores
Public Class Form2
Dim v%(), v1%(), v2$(), tam%
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
REM pedir el tamaño del vector
tam = InputBox("digite el tamaño del vector")
REM REDIMENSIONAR EL VETOR
ReDim v(tam)
REM llenado del vector
For i = 0 To tam - 1
v(i) = InputBox("digite los elementos del vector")
Next
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
For i = 0 To tam - 1
Me.ListBox1.Items.Add(v(i))
Me.ListBox2.Items.Add(v1(i))
Me.ListBox3.Items.Add(v2(i))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For i = 0 To tam - 1
v2(i) = v(i) + v1(i)
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For i = 0 To tam - 1
v2(i) = v(i) - v1(i)
Next
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
For i = 0 To tam - 1
v2(i) = v(i) * v1(i)
Next
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
For i = 0 To tam - 1
v2(i) = v(i) / v1(i)
Next
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
For i = 0 To tam - 1
v2(i) = v(i) ^ v1(i)
Next
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
For i = 0 To tam - 1
v2(i) = v(i) ^ (1 / v1(i))
Next
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Me.ListBox1.Text = ""
Me.ListBox2.Text = ""
Me.ListBox3.Text = ""
End Sub
End Class
Comentarios
Publicar un comentario