Ejercicios Vectores Simples Visual Basic

Páginas: 3 (583 palabras) Publicado: 14 de junio de 2012
1: ORDENAR Y BUSCAR ELEMENTO DE UN VECTOR

Dim v(50) As Integer
Dim n As Integer
Dim i As Integer
Dim j As Integer
Dim g As Integer
Dim k As Integer
Dim m As String
Dim o As StringPrivate Sub CmdBuscar_Click()
g = 0
i = Val(TextDato.Text)
For j = 1 To n Step 1
If i = v(j) Then
TextResultado.Text = "dato encontrado en la posicion"
TextResul.Text = j
g = 1
End If
Next
If g =0 Then
TextResultado.Text = "dato no encontrado"
End If
End Sub

Private Sub CmdIng_Click()
n = Val(TextTamaño.Text)
If (j < n) Then
j = j + 1
v(j) = Val(TextDato.Text)
m = m +(TextDato.Text) + ","
TextDato.Text = ""
Else
TextResultado.Text = "vector lleno ultimo dato no ingresa"
End If
TextMostrar.Text = m
End Sub

Private Sub CmdOrdenar_Click()
o = ""
TextResultado.Text =""
For k = 1 To n Step 1
For j = 1 To n Step 1
If v(k) < v(j) Then
aux = v(k)
v(k) = v(j)
v(j) = aux
End If
Next
Next
For j = 1 To n Step 1
TextResul.Text = v(j)
o = o + TextResul.Text +","
Next
TextResultado.Text = o
TextResul.Text = ""
End Sub

Private Sub Command1_Click()
o = ""
TextResultado.Text = ""
For k = 1 To n Step 1
For j = 1 To n Step 1
If v(k) > v(j) Then
aux =v(k)
v(k) = v(j)
v(j) = aux
End If
Next
Next
For j = 1 To n Step 1
TextResul.Text = v(j)
o = o + TextResul.Text + ","
Next
TextResultado.Text = o
TextResul.Text = ""
End Sub

PrivateSub CmdSalir_Click()
vec1.Hide
Form1.Show
End Sub

2: SUMAR VECTORES

Dim v1(50) As Integer
Dim v3(50) As Integer
Dim v5(50) As Integer
Dim n1 As Integer
Dim i As Integer
Dim j As IntegerDim b As Integer
Dim a As String
Dim c As String
Dim d As String


Private Sub Cmd1_Click()
n1 = Val(TextTamaño1.Text)
If (j < n1) Then
j = j + 1
v3(j) = Val(TextDato2.Text)
a = a +(TextDato2.Text) + ","
TextDato2.Text = ""
Else
TextMostrar1.Text = "vector lleno ultimo dato no ingresa"
End If
End Sub

Private Sub CmdIng_Click()
n1 = Val(TextTamaño1.Text)
If (i < n1) Then...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Ejercicios visual basic basico
  • Vectores Y Matrices De Visual Basic
  • Ejercicios de Visual Basic .NET
  • ejercicio visual basic
  • ejercicios de visual basic 6.0
  • Ejercicios Visual Basic
  • Ejercicios De Visual Basic 6.0
  • Ejercicios De Inteligencia De Negocios Con Visual Basic

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS