0% found this document useful (0 votes)
36 views

Module Module1

The document contains code for a Visual Basic program that presents the user with menu options to calculate integrals using different methods or view graphical representations. The integral calculation section allows the user to select the integration method (e.g. rectangles, trapezoids), enter the limits of integration, and number of divisions to compute the integral. The graphics section includes code to draw representations like a tennis court, Tower of Hanoi puzzle, and checkerboard.

Uploaded by

Angela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Module Module1

The document contains code for a Visual Basic program that presents the user with menu options to calculate integrals using different methods or view graphical representations. The integral calculation section allows the user to select the integration method (e.g. rectangles, trapezoids), enter the limits of integration, and number of divisions to compute the integral. The graphics section includes code to draw representations like a tennis court, Tower of Hanoi puzzle, and checkerboard.

Uploaded by

Angela
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Module Module1

Sub Main()
Dim op As Integer

While op <> 3
Console.SetCursorPosition(32, 2)
Console.Write("PROGRAMACION BÁSICA")
Console.SetCursorPosition(2, 3)
Console.Write("1.-Integrales")
Console.SetCursorPosition(2, 5)
Console.Write("2.-Gráficos")
Console.SetCursorPosition(2, 7)
Console.Write("3.-Fin")
Console.SetCursorPosition(2, 9)
Console.Write("Escoger opcion: ")
op = Console.ReadLine

Console.Clear()

Select Case op

Case 1
Dim op_i As Integer
Console.SetCursorPosition(32, 2)
Console.Write("INTEGRALES")
Console.SetCursorPosition(2, 3)
Console.Write("1.-Inscritos")
Console.SetCursorPosition(2, 5)
Console.Write("2.-Circunscritos")
Console.SetCursorPosition(2, 7)
Console.Write("3.-Punto Medio")
Console.SetCursorPosition(2, 9)
Console.Write("4.-Trapecial")
Console.SetCursorPosition(2, 11)
Console.Write("5.-Fin")
Console.SetCursorPosition(2, 13)
Console.Write("Elige método: ")
op_i = Console.ReadLine
Console.Clear()
Select Case op_i
Case 1
Dim nd, i, ancho, x, area As Single
Dim a, b As Integer

Console.Write("Digite limite inferior:")


a = Console.ReadLine()
Console.Write("Digite limite superior:")
b = Console.ReadLine()
Console.Write("Digite numeros de divisiones: ")
nd = Console.ReadLine()
ancho = (b - a) / nd
i = 0
area = 0
For x = a To b - ancho Step ancho
area = x ^ 2 * ancho
i = i + area
Next
Console.Write("La integral es {0}", i)
Console.ReadLine()

Console.Clear()

Case 2
Dim nd, i, ancho, x, area As Single
Dim a, b As Integer

Console.Write("Digite limite inferior:")


a = Console.ReadLine()
Console.Write("Digite limite superior:")
b = Console.ReadLine()
Console.Write("Digite numeros de divisiones: ")
nd = Console.ReadLine()
ancho = (b - a) / nd
i = 0
area = 0
For x = a + ancho To b Step ancho
area = x ^ 2 * ancho
i = i + area
Next
Console.Write("La integral es {0}", i)
Console.ReadLine()

Case 3
Dim nd, i, ancho, x, area As Single
Dim a, b As Integer

Console.Write("Digite limite inferior:")


a = Console.ReadLine()
Console.Write("Digite limite superior:")
b = Console.ReadLine()
Console.Write("Digite numeros de divisiones: ")
nd = Console.ReadLine()
ancho = (b - a) / nd
i = 0
area = 0
For x = a + ancho / 2 To b - ancho / 2 Step ancho
area = x ^ 2 * ancho
i = i + area
Next
Console.Write("La integral es {0}", i)
Console.ReadLine()
Case 4
Dim nd, i, altura, x, area As Single
Dim a, b As Integer

Console.Write("Digite limite inferior:")


a = Console.ReadLine()
Console.Write("Digite limite superior:")
b = Console.ReadLine()
Console.Write("Digite numeros de divisiones: ")
nd = Console.ReadLine()

altura = (b - a) / nd
i = 0
area = 0
For x = a To b - altura Step altura
area = (x ^ 2 + (x + altura) ^ 2) * altura / 2
i = i + area
Next
Console.Write("La integral es {0}", i)
Console.ReadLine()

Console.Clear()

Case 5

Console.SetCursorPosition(35, 23)
Console.Write("Presione enter para volver a menú principal")

Dim col, fil As Integer

Console.ForegroundColor = 9
Console.SetCursorPosition(33, 12)
Console.Write("SALIENDO DE PROGRAMA")

For col = 1 To 80 Step 1


Console.ForegroundColor = 15

Console.SetCursorPosition(col, 1)
Console.Write("*")
Console.SetCursorPosition(col, 24)
Console.Write("*")

Next
For fil = 1 To 24 Step 1
Console.ForegroundColor = 15
Console.SetCursorPosition(1, fil)
Console.Write("*")
Console.SetCursorPosition(80, fil)
Console.Write("*")

Next
Console.ReadLine()
Console.Clear()

End Select

Case 2
Dim op_g As Integer
Console.SetCursorPosition(32, 2)
Console.Write("Gráficos")
Console.SetCursorPosition(2, 3)
Console.Write("1.-Cancha de Tennis")
Console.SetCursorPosition(2, 5)
Console.Write("2.-Torre de Hanoi")
Console.SetCursorPosition(2, 7)
Console.Write("3.-Ajedrez")
Console.SetCursorPosition(2, 9)
Console.Write("4.-Tabla de multiplicar")
Console.SetCursorPosition(2, 11)
Console.Write("5.-Fin")
Console.SetCursorPosition(2, 13)
Console.Write("Elige Grafico: ")
op_g = Console.ReadLine
Console.Clear()
Select Case op_g

Case 1
Dim col As Integer
Dim fil As Integer
Dim a, b As Integer
Console.SetCursorPosition(1, 26)
Console.WriteLine("Presione enter para cambiar de colores a
la cancha")

For a = 2 To 14
For col = 0 To 79
For fil = 0 To 23
Console.SetCursorPosition(col, fil)

Console.Write(" ")
Console.BackgroundColor = a
Console.WriteLine()

Next
Next

Console.BackgroundColor = 15
For col = 1 To 80 Step 1

Console.SetCursorPosition(col, 0)
Console.Write(" ")
Console.SetCursorPosition(col, 4)
Console.Write(" ")
Console.SetCursorPosition(col, 24)
Console.Write(" ")

Next

For col = 1 To 80 Step 1

Console.SetCursorPosition(col, 20)
Console.Write(" ")

Next

For col = 10 To 70 Step 1

Console.SetCursorPosition(col, 12)
Console.Write(" ")
Next
For fil = 1 To 24 Step 1

Console.SetCursorPosition(0, fil)
Console.Write(" ")
Console.SetCursorPosition(80, fil)
Console.Write(" ")
Console.SetCursorPosition(40, fil)
Console.Write(" ")

Next

For fil = 5 To 20 Step 1

Console.SetCursorPosition(10, fil)
Console.Write(" ")

Console.SetCursorPosition(70, fil)
Console.Write(" ")
Next

Console.ReadLine()
Next

Console.ReadLine()

Console.Clear()
Console.BackgroundColor = ConsoleColor.Black
Console.WriteLine(" ")
Case 2

Dim col, fil As Integer

Console.SetCursorPosition(32, 1)
Console.WriteLine("LA TORRE DE HANOI")

For col = 10 To 70
For fil = 20 To 22
Console.SetCursorPosition(col, fil)
Console.BackgroundColor = ConsoleColor.Yellow
Console.WriteLine(" ")
Next
Next
For col = 15 To 65
For fil = 17 To 19
Console.SetCursorPosition(col, fil)
Console.BackgroundColor = ConsoleColor.DarkGreen

Console.WriteLine(" ")
Next
Next
For col = 20 To 60
For fil = 14 To 16
Console.SetCursorPosition(col, fil)
Console.BackgroundColor = ConsoleColor.DarkBlue
Console.WriteLine(" ")
Next

Next
For col = 25 To 55
For fil = 11 To 13
Console.SetCursorPosition(col, fil)
Console.BackgroundColor = ConsoleColor.Gray
Console.WriteLine(" ")
Next

Next
For col = 30 To 50
For fil = 8 To 10
Console.SetCursorPosition(col, fil)
Console.BackgroundColor = ConsoleColor.Cyan
Console.WriteLine(" ")
Next

Next
For col = 35 To 45
For fil = 5 To 7
Console.SetCursorPosition(col, fil)
Console.BackgroundColor = ConsoleColor.DarkRed
Console.WriteLine(" ")
Next

Next

Console.ResetColor()

Console.ReadLine()

Console.Clear()

Case 3

Dim col, fil, A, B, cont As Integer


A = 0
B = -5

For col = 6 To 45
For fil = 1 To 24
Console.BackgroundColor = ConsoleColor.White
Console.SetCursorPosition(col, fil)
Console.Write(" ")
Next
Next
For cont = 1 To 4
A = A + 10
B = B + 10
For col = 1 + A To 5 + A
For fil = 1 To 3
Console.BackgroundColor = ConsoleColor.Blue
Console.SetCursorPosition(col, fil)
Console.Write(" ")
Next
Next
For col = 1 + B To 5 + B
For fil = 4 To 6
Console.BackgroundColor = ConsoleColor.Blue
Console.SetCursorPosition(col, fil)
Console.Write(" ")
Next
Next
For col = 1 + A To 5 + A
For fil = 7 To 9
Console.BackgroundColor = ConsoleColor.Blue
Console.SetCursorPosition(col, fil)
Console.Write(" ")
Next
Next
For col = 1 + B To 5 + B
For fil = 10 To 12
Console.BackgroundColor = ConsoleColor.Blue
Console.SetCursorPosition(col, fil)
Console.Write(" ")
Next
Next
For col = 1 + A To 5 + A
For fil = 13 To 15
Console.BackgroundColor = ConsoleColor.Blue
Console.SetCursorPosition(col, fil)
Console.Write(" ")
Next
Next
For col = 1 + B To 5 + B
For fil = 16 To 18
Console.BackgroundColor = ConsoleColor.Blue
Console.SetCursorPosition(col, fil)
Console.Write(" ")
Next
Next
For col = 1 + A To 5 + A
For fil = 19 To 21
Console.BackgroundColor = ConsoleColor.Blue
Console.SetCursorPosition(col, fil)
Console.Write(" ")
Next
Next
For col = 1 + B To 5 + B
For fil = 22 To 24
Console.BackgroundColor = ConsoleColor.Blue
Console.SetCursorPosition(col, fil)
Console.Write(" ")
Next
Next

Next
Console.BackgroundColor = ConsoleColor.Black
Console.WriteLine(" ")
Console.ReadLine()
Console.Clear()

Case 4

Dim a, b, mult, c As Integer


Console.SetCursorPosition(32, 1)
Console.WriteLine("TABLA DE MULTIPLICAR")
c = -16
For a = 1 To 5 Step 1
c = c + 17
For b = 1 To 10 Step 1
mult = a * b

Console.SetCursorPosition(c, b + 1)
Console.WriteLine("{0}x{1}={2}", a, b, mult)

Next
Next
c = -16
For a = 6 To 10 Step 1
c = c + 17
For b = 1 To 10 Step 1
mult = a * b
Console.SetCursorPosition(c, 12 + b)
Console.WriteLine("{0}x{1}={2}", a, b, mult)
Console.Clear()
Next
Next
Console.ReadLine()
Case 5
Dim col, fil As Integer
Console.SetCursorPosition(35, 23)
Console.Write("Presione enter para volver a menú principal")

Console.ForegroundColor = 9
Console.SetCursorPosition(33, 12)
Console.Write("SALIENDO DE PROGRAMA")

For col = 1 To 80 Step 1


Console.ForegroundColor = 15

Console.SetCursorPosition(col, 1)
Console.Write("*")
Console.SetCursorPosition(col, 24)
Console.Write("*")

Next
For fil = 1 To 24 Step 1
Console.ForegroundColor = 15
Console.SetCursorPosition(1, fil)
Console.Write("*")
Console.SetCursorPosition(80, fil)
Console.Write("*")

Next
Console.ReadLine()
Console.Clear()

End Select
Console.ReadLine()
Case 3
Dim col, fil As Integer

Console.ForegroundColor = 9
Console.SetCursorPosition(33, 12)
Console.Write("SALIENDO DE PROGRAMA")

For col = 1 To 80 Step 1


Console.ForegroundColor = 15

Console.SetCursorPosition(col, 1)
Console.Write("*")
Console.SetCursorPosition(col, 24)
Console.Write("*")

Next
For fil = 1 To 24 Step 1
Console.ForegroundColor = 15
Console.SetCursorPosition(1, fil)
Console.Write("*")
Console.SetCursorPosition(80, fil)
Console.Write("*")

Next
Console.ReadLine()
Console.Clear()

End Select

End While
Console.ReadLine()
End Sub

End Module

You might also like