Programación 12
Programación 12
CURSO
DOCENTE
GRUPO COOPER:
* Chvez Mendoza, Sheyla
* Guzmn Coaguila, Diana
* Pulcha Montenegro, Vanessa
For x = 0 To ncur - 1
Console.SetCursorPosition(18 + x * 8, 2)
Console.Write(" {0} ", nomcur(x))
Next
End Sub
Sub pro_alu(ByVal notas(,) As Integer, ByVal nalum As Single, ByVal ncur As Single, ByVal pral() As Single)
Dim sumanota As Integer = 0
For n = 0 To nalum - 1
For z = 0 To ncur - 1
sumanota = sumanota + notas(z, n)
Next
pral(n) = sumanota / nalum
Console.SetCursorPosition(18 + 8 * ncur, 3 + n)
Console.Write(" {0} ", pral(n))
sumanota = 0
Next
End Sub
Sub pro_cur(ByVal notas(,) As Integer, ByVal nalum As Single, ByVal ncur As Single, ByRef prcu() As Single)
Dim sumanota As Integer = 0
For z = 0 To nalum - 1
For n = 0 To ncur - 1
sumanota = sumanota + notas(z, n)
Next
prcu(z) = sumanota / nalum
Console.SetCursorPosition(18 + 8 * z, 3 + nalum)
Console.Write(" {0} ", prcu(z))
sumanota = 0
Next
End Sub
Sub RANKING(ByVal nomalum() As String, ByVal pral() As Single, ByVal nalum As Single)
Dim I, J, T As Integer
Dim TE As String
For I = 0 To nalum - 2
For J = I + 1 To nalum - 1
If pral(I) < pral(J) Then
T = pral(I)
pral(I) = pral(J)
pral(J) = T
TE = nomalum(I)
nomalum(I) = nomalum(J)
nomalum(J) = TE
End If
Next
Next
Console.ForegroundColor = ConsoleColor.Magenta
Console.SetCursorPosition(10, 10)
Console.WriteLine("RANKING DE NOTAS")
Console.WriteLine("************************************")
Console.SetCursorPosition(3, 12)
Console.WriteLine("PUESTO NOMBRES
NOTAS ")
For I = 0 To nalum - 1
Console.ForegroundColor = ConsoleColor.Cyan
Console.SetCursorPosition(5, I + 14)
Console.WriteLine("{0}
{1}", I + 1, nomalum(I))
Console.SetCursorPosition(29, I + 14)
Console.WriteLine("{0}", pral(I))
J=J+1
Next
End Sub
Sub proalumnos(ByVal pral() As Single, ByVal nalum As Single)
Dim suma As Single = 0
For x = 0 To nalum
suma = suma + pral(x)
Next
Console.WriteLine("
El promedio de todos los alumnos es {0}", suma / nalum)
End Sub
Sub procurso(ByVal prcu() As Single, ByVal ncur As Single)
Dim suma As Single = 0
For x = 0 To ncur
3-
LA
TINKA
Module Module1
Sub ingresa(ByRef n As Integer)
Console.Write("INGRESE EL NRO DE JUGADAS : ")
n = Console.ReadLine
End Sub
Sub mostrarv(ByVal c() As Integer, ByVal n As Integer, ByVal a As Integer)
Dim x As Integer
Console.WriteLine(" ")
Console.ForegroundColor = ConsoleColor.Green
For x = 0 To n - 1
Console.SetCursorPosition(a, x + 4)
Console.WriteLine("{0}", c(x))
Next
End Sub
Sub generar(ByVal V() As Integer, ByVal n As Integer)
Dim a, b, num As Integer
For a = 0 To n - 1
num = Rnd() * 49 + 1
If a > 0 Then
For b = 0 To n - 1
If num = V(b) Then
num = Rnd() * 49 + 1
b = -1
End If
Next
End If
V(a) = num
Next
End Sub
Sub jugada(ByVal j(,) As Integer, ByVal n As Integer)
Dim a, b, c, num As Integer
Console.ForegroundColor = ConsoleColor.Yellow
Console.WriteLine(" ")
Console.WriteLine(" ")
Console.WriteLine(" ")
For a = 0 To n - 1
Console.WriteLine(" ")
For b = 0 To 5
num = Rnd() * 45 + 1
If b > 0 Then
For c = 0 To 5
If num = j(a, c) Then
num = Rnd() * 45 + 1
c = -1
End If
Next
End If
j(a, b) = num
Console.Write("{0,10:F0}", j(a, b))
Next
Next
Console.WriteLine(" ")
End Sub
Sub comparar(ByVal jg() As Integer, ByVal j(,) As Integer, ByVal n As Integer, ByVal c() As Integer)
Dim x, y, z As Integer
For x = 0 To n - 1
For y = 0 To 5
")
FRECUENCIA(c, A, n)
Console.ReadLine()
End Sub
End Module
End If
Next
Dim ptj(n, m) As Integer
Dim puntos(n) As Integer
Dim puntaje As Integer = 0
Dim z As Integer
Dim vector(n, 0) As Integer
For z = 0 To m - 1
vector(n, 0) = Rnd() * 4 + 1
Console.ForegroundColor = ConsoleColor.Green
Console.WriteLine("La respuesta de la pregunta {0} es {1}", z + 1, vector(n, 0))
Next
For x = 0 To n - 1
puntaje = 0
For y = 0 To m - 1
ptj(x, y) = Rnd() * 4 + 1
If ptj(x, y) = vector(n, 0) Then
puntaje = puntaje + 1
End If
Next
puntos(x) = puntaje
Console.ForegroundColor = ConsoleColor.White
Console.WriteLine("El puntaje del alumno con codigo {0} es {1}", cod(x), puntos(x))
Next
Dim ind As Integer = 0
Dim maynota As Integer = 0
Dim pos As Integer = 0
Dim rank(n) As Integer
Dim l As Integer
For l = 0 To 2
maynota = 0
For ind = 0 To n - 1
If puntos(ind) > maynota Then
maynota = puntos(ind)
pos = ind
End If
rank(l) = maynota
Next
Console.WriteLine("El puesto {0} lo ocupa el codigo {1} con un puntaje de {2}", (l + 1), cod(pos),
rank(l))
puntos(pos) = 0
Next
End Sub
Sub Main()
Randomize()
Dim n As Integer
Dim m As Integer = 60
Dim puntaje As Integer = 0
Dim v(n) As Integer
nalum(n)
Dim vector(n, 0) As Integer
Dim Matriz(n, m) As Integer
Dim cod(n, 0) As Integer
puntajes(n, m)
Console.ReadLine()
End Sub
End Module