Hacer un programa o algoritmo que permita mostrar alumnos ordenados por mayor puntaje de promedio.
Solución
- Entrada: Juan 12, lucia 10, alex 16,Sandra 14
- Salida: alex16,Sandra 14,juan 12,lucia 10
Public Class Form1 Dim w As Integer = 0 Dim c As Integer = 0 Dim cad As String = "" Dim t, p, lon, tem As Integer Dim n, aux As String Dim Nom() As String Dim Prom() As Integer Public Sub inicializar(ByVal tam As Integer) ReDim Nom(tam - 1) For i As Integer = 0 To (tam - 1) Nom(i) = "" Next i ReDim Prom(tam - 1) For j As Integer = 0 To (tam - 1) Prom(j) = 0 Next j End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click lon = TextBox1.Text n = TextBox2.Text p = TextBox3.Text If (c <> lon) Then Nom(c) = n Prom(c) = p c = c + 1 Else While (w <> (lon - 1)) w = 0 For k As Integer = 0 To (lon - 2) If (Prom(k) >= Prom(k + 1)) Then w = w + 1 Else tem = Prom(k) Prom(k) = Prom(k + 1) Prom(k + 1) = tem aux = Nom(k) Nom(k) = Nom(k + 1) Nom(k + 1) = aux End If Next k End While For x As Integer = 0 To (lon - 1) cad = cad + "Nombre: " + Nom(x) + " Nota: " + Trim(Prom(x)) & vbCrLf Next x TextBox4.Text = cad End If 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
1 comentarios:
hola disculpa estudio en la ricardo palma y el visual que usamos por el momento es el visual basic 6.0 quiera que me ayudes porque es muy diferente quisiera que me ayudes poniendo el programa pero que corra el visual basic 6.0 ya lo inetente copiar pegar acomodar pero no corre.
Publicar un comentario