Hacer un programa o algoritmo que permita ingresar un elemento en una posición indicada en un arreglo de n elementos (números), hasta que el usuario desee salir.
Codigo Fuente en Visual Basic
Public Class Form1 Dim N() As Integer Dim t As Integer Dim num, pos As Integer Dim cad As String = "" Public Sub inicializar(ByVal tam As Integer) ReDim N(tam - 1) For i As Integer = 0 To (tam - 1) N(i) = 0 Next i End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click cad = "" num = TextBox2.Text pos = TextBox3.Text N(pos - 1) = num For j As Integer = 0 To N.Length - 1 cad = cad + " " + Trim(N(j)) Next j TextBox4.Text = cad End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged t = TextBox1.Text inicializar(t) End Sub End Class
0 comentarios:
Publicar un comentario