0% found this document useful (0 votes)
12 views

Ingrese El Numero de Caracteres Del Arreglo

This Visual Basic code prompts the user to enter the size of an array, fills the array with user-inputted values, prompts the user to enter a number to search for, searches the array for that number and returns its index position, or returns 1000 if not found. It demonstrates functions for filling an array with user input, searching an array for a value, and returning the index position or default value.

Uploaded by

Miguel Angel C C
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Ingrese El Numero de Caracteres Del Arreglo

This Visual Basic code prompts the user to enter the size of an array, fills the array with user-inputted values, prompts the user to enter a number to search for, searches the array for that number and returns its index position, or returns 1000 if not found. It demonstrates functions for filling an array with user input, searching an array for a value, and returning the index position or default value.

Uploaded by

Miguel Angel C C
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Module Module1 Sub Main() Dim x, y, resultado As Integer Console.WriteLine("ingrese el numero de caracteres del arreglo") x = Console.

ReadLine Dim numero(x - 1) As Integer Call llenar(numero, x - 1) Console.WriteLine("ingrese el numero a buscar") y = Console.ReadLine resultado = encontrar(numero, x - 1, y) Console.WriteLine("la pisicion es {0}", resultado) Console.ReadLine() End Sub Sub llenar(ByRef a() As Integer, ByVal tamao As Integer) Dim k As Double For k = 0 To tamao Step 1 Console.WriteLine("ingrese valor para la posicion a({0})", k) a(k) = Console.ReadLine Next End Sub Function encontrar(ByVal a() As Integer, ByVal y As Integer, ByVal z As Integer) As Integer Dim r As Integer For l = 0 To y Step 1 If z = a(l) Then r = l Else r = 1000 End If

Next

encontrar = r End Function End Module

You might also like