Hacer un programa o algoritmo que permita eliminar un alumno de un salón de clase, dada una posición indicada
Solución
- Entrada: 1 3
- Salida: 1 1 0
Public Class Form1 Dim f, c As Integer Dim M(3, 3) As Integer Dim cad As String = "" Dim cad2 As String = "" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click f = TextBox1.Text c = TextBox2.Text M((f - 1), (c - 1)) = 0 For i As Integer = 0 To 2 For k As Integer = 0 To 2 cad2 = cad2 + " " + Trim(M(i, k)) Next k cad2 = cad2 & vbCrLf Next i TextBox4.Text = cad2 End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load For i As Integer = 0 To 2 For k As Integer = 0 To 2 M(i, k) = 1 cad = cad + " " + Trim(M(i, k)) Next k cad = cad & vbCrLf Next i TextBox3.Text = cad End Sub End Class
0 comentarios:
Publicar un comentario