Professional Documents
Culture Documents
Menu de Colas, Pilas y Alumnos
Menu de Colas, Pilas y Alumnos
SAN AGUSTIN
FACULTAD DE INGENIERÍA DE
PRODUCCIÓN Y SERVICIOS
ESCUELA PROFESIONAL DE
INGENIERIA INDUSTRIAL
PRESENTADO POR:
Mejía García, Erich Douglas
1. MENU DE COLAS
Module Module1
Sub Main()
Dim m As Integer
Dim n As Integer
n = 4
Dim C(n) As String
Dim op As Integer
Dim i As Integer
Cola(C, n)
Console.Clear()
Do
Console.Clear()
menu()
op = Console.ReadLine
Select Case (op)
Case 1
Console.Clear()
Console.SetCursorPosition(32, 2)
Console.Write("COLA")
Console.SetCursorPosition(4, 5)
For i = 0 To n - 1
Console.Write(" {0} ", C(i))
Next
Console.ReadLine()
Case 2
n = n - 1
Sale(C, n)
Case 3
Console.Clear()
n = n + 1
entra(C, n)
Case 4
End
End Select
Loop
End Sub
Sub menu()
Console.ForegroundColor = 7
Console.SetCursorPosition(33, 3)
Console.WriteLine("MENU DE COLAS")
Console.SetCursorPosition(3, 5)
Console.WriteLine(" 1. Mostrar cola ")
Console.SetCursorPosition(3, 7)
Console.WriteLine(" 2. Sale ")
Console.SetCursorPosition(3, 9)
Console.WriteLine(" 3. Entra ")
Console.SetCursorPosition(3, 11)
Console.WriteLine(" 4. FIN ")
Console.SetCursorPosition(3, 13)
Console.Write(" Escoger: ")
End Sub
Sub Cola(ByRef C() As String, ByVal n As Integer)
Dim i As Integer
C(0) = "Paco"
C(1) = "Maria"
C(2) = "Carlos"
C(3) = "Luis"
For i = 0 To n - 1
Console.Write(" {0} ", C(i))
Next
End Sub
Sub Sale(ByRef C() As String, ByVal n As Integer)
Dim i As Integer
For i = 0 To n - 1
C(i) = C(i + 1)
Next
End Sub
Sub entra(ByRef C() As String, ByVal n As Integer)
Dim nuevo As String
Console.Write("Escriba el nombre del que ingresa a la cola: ")
nuevo = Console.ReadLine
C(n - 1) = nuevo
End Sub
End Module
2. MENU DE PILAS
Module module1
Sub main()
Const max As Integer = 30
Dim pila(max), ne, op, i As Integer
ne = 0
Do
Console.ForegroundColor = 7
Console.WriteLine()
Console.WriteLine(" MENU DE PILAS ")
Console.WriteLine("1. INGRESAR DATOS")
Console.WriteLine("2. SACAR LOS ELEMENTOS DE LA PILA ")
Console.WriteLine("3. LISTAR DATOS ")
Console.WriteLine(" 4. SALIR ")
Console.Write(" INGRESE OPCION : ")
op = Console.ReadLine()
Console.ForegroundColor = ConsoleColor.White
Select (op)
Case 1 : For i = ne To 1 Step -1
pila(i) = pila(i - 1)
Next
Console.Write(" INGRESE EL ELEMENTO {0} A LA PILA: ", ne)
pila(0) = Console.ReadLine()
ne += 1
Module Module1
Sub Main()
Dim n, o As Integer
n = 10
Dim nota(n) As Integer
Dim nombre(n) As String
Do
marco()
menu()
o = Console.ReadLine
Console.Clear()
Select Case o
Case 1
Datos(nombre, nota, n)
Console.Clear()
Case 2
notamayor(nombre, nota, n)
Console.Clear()
Case 3
notamenor(nombre, nota, n)
Console.Clear()
Case 4
apro_desa(nota, n)
Console.Clear()
Case 5
frecuencia(nota, n)
Console.Clear()
Case 6
moda_Fre(nota, n)
Console.Clear()
Case 7 = False
End Select
Loop While o < 7
End Sub
Sub moda_Fre(ByVal t() As Integer, ByVal a As Integer)
Dim i, aa, ii, c, m, mi As Integer
m = 0
aa = 20
Dim p(aa) As Integer
For i = 0 To aa
c = 0
For ii = 0 To a - 1
If i = t(ii) Then
c = c + 1
End If
Next ii
p(i) = c
If p(i) > m Then
m = p(i)
mi = i
End If
Next
marco()
Console.SetCursorPosition(37, 3)
Console.ForegroundColor = ConsoleColor.Magenta
Console.WriteLine("MODA")
Console.ForegroundColor = ConsoleColor.Green
Console.SetCursorPosition(3, 5)
Console.WriteLine("La moda es: {0}", mi)
Console.ReadLine()
End Sub
End Sub
Sub notamayor(ByVal b() As String, ByVal t() As Integer, ByVal a As Integer)
marco()
Console.SetCursorPosition(34, 3)
Console.ForegroundColor = ConsoleColor.Magenta
Console.WriteLine("NOTA MAYOR")
Console.ForegroundColor = ConsoleColor.DarkCyan
Console.SetCursorPosition(3, 5)
Dim i, q As Integer
q = 0
For i = 0 To a - 1
If t(i) > q Then
q = t(i)
End If
Next
For i = 0 To a - 1
If t(i) = q Then
Console.SetCursorPosition(3, 5)
Console.ForegroundColor = ConsoleColor.Green
Console.WriteLine("{0} tiene la nota mayor, y es: {1}", b(i), t(i))
End If
Next
Console.ReadLine()
End Sub
Sub Datos(ByRef b() As String, ByRef t() As Integer, ByVal a As Integer)
Dim x As Integer
For x = 0 To a - 1
Titulo()
Console.Write("Ingrese nombre: ")
b(x) = Console.ReadLine
Console.Write(" Nota: ")
t(x) = 1 + Rnd() * 20
Console.Write("{0}", t(x))
Console.ReadLine()
Console.WriteLine("")
Console.Clear()
Next
End Sub
Sub Titulo()
marco()
Console.SetCursorPosition(31, 3)
Console.ForegroundColor = ConsoleColor.Magenta
Console.WriteLine("DATOS ALEATORIOS")
Console.ForegroundColor = ConsoleColor.DarkCyan
Console.SetCursorPosition(3, 5)
End Sub
End Module