Sunteți pe pagina 1din 5

ESCUELA DE INGENIERA INDUSTRIAL

PROGRAMACION Y METODOS NUMERICOS

Module Module1
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
If jg(y) = j(x, y) Then
z=z+1
End If
Next
c(x) = z
z=0
Next
End Sub
Sub ingresa(ByRef n As Integer)
Console.Write("Ingrese el numero de jugadas: ")
n = Console.ReadLine
End Sub
Sub mostrarv(ByVal c() As Integer, ByVal n As Integer, ByVal a As Integer)

Escuela de Ingeniera Industrial

JUEGO DE LOTERIA
LA TINKA

ESCUELA DE INGENIERA INDUSTRIAL


PROGRAMACION Y METODOS NUMERICOS

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))

")

Escuela de Ingeniera Industrial

Next
End Sub
Sub mostrar(ByVal a() As Integer, ByVal n As Integer)
Dim i As Integer
Console.ForegroundColor = ConsoleColor.White
Console.BackgroundColor = ConsoleColor.DarkRed
Console.WriteLine(" ")
Console.WriteLine("
JUGADA GANADORA
For i = 0 To n - 1
Console.BackgroundColor = ConsoleColor.Black
Console.Write("{0,10:D}", a(i))
Next
End Sub
Sub FRECUENCIA(ByVal C() As Integer, ByVal A() As Integer, ByVal N As Integer)
Dim X, Z, CO As Integer
For Z = 1 To 6
For X = 0 To N - 1
If C(X) = Z Then
CO = CO + 1
End If
A(Z) = CO
Next
CO = 0
Console.SetCursorPosition(30, Z + 40)
Console.WriteLine("{0}", A(Z))
Next
End Sub
Sub texto()
Dim x As Integer
Console.ForegroundColor = ConsoleColor.White
Console.BackgroundColor = ConsoleColor.Blue
Console.SetCursorPosition(30, 0)
Console.WriteLine(" TINKA")
Console.SetCursorPosition(30, 1)
Console.WriteLine(" =====")
Console.SetCursorPosition(0, 2)
Console.WriteLine("CODIGO")
Console.SetCursorPosition(30, 2)
Console.WriteLine(" JUGADAS")
Console.SetCursorPosition(67, 2)
Console.WriteLine("ACIERTOS")
Console.SetCursorPosition(3, 41)
Console.WriteLine("GANADORES CON 1 ACIERTO: ")
Console.SetCursorPosition(3, 42)
Console.WriteLine("GANADORES CON 2 ACIERTOS: ")
Console.SetCursorPosition(3, 43)
Console.WriteLine("GANADORES CON 3 ACIERTOS: ")
Console.SetCursorPosition(3, 44)
Console.WriteLine("GANADORES CON 4 ACIERTOS: ")
Console.SetCursorPosition(3, 45)
Console.WriteLine("GANADORES CON 5 ACIERTOS: ")
Console.SetCursorPosition(3, 46)
Console.WriteLine("GANADORES CON 6 ACIERTOS: ")
For x = 2 To 38
Console.SetCursorPosition(6, x)
Console.WriteLine("|")
Console.SetCursorPosition(65, x)

Console.WriteLine("|")
Next
For x = 0 To 77
Console.SetCursorPosition(x, 3)
Console.WriteLine("-")
Console.SetCursorPosition(x, 36)
Console.WriteLine("-")
Next
End Sub
Sub Main()
Dim n As Integer
ingresa(n)
Console.Clear()
Dim v(n), j(n, 6), jg(6), c(n), A(6) As Integer
generar(v, n)
jugada(j, n)
generar(jg, 6)
comparar(jg, j, n, c)
mostrarv(v, n, 2)
mostrarv(c, n, 70)
mostrar(jg, 6)
texto()
FRECUENCIA(c, A, n)
Console.ReadLine()
End Sub
End Module

Escuela de Ingeniera Industrial

ESCUELA DE INGENIERA INDUSTRIAL


PROGRAMACION Y METODOS NUMERICOS

Escuela de Ingeniera Industrial

ESCUELA DE INGENIERA INDUSTRIAL


PROGRAMACION Y METODOS NUMERICOS

S-ar putea să vă placă și