0% found this document useful (0 votes)
6 views10 pages

Basic Programming: Integrals & Graphs

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)
6 views10 pages

Basic Programming: Integrals & Graphs

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

Module Module1

Sub Main()
Dim op As Integer

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

[Link]()

Select Case op

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

[Link]("Digite limite inferior:")


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

[Link]()

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

[Link]("Digite limite inferior:")


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

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

[Link]("Digite limite inferior:")


a = [Link]()
[Link]("Digite limite superior:")
b = [Link]()
[Link]("Digite numeros de divisiones: ")
nd = [Link]()
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
[Link]("La integral es {0}", i)
[Link]()
Case 4
Dim nd, i, altura, x, area As Single
Dim a, b As Integer

[Link]("Digite limite inferior:")


a = [Link]()
[Link]("Digite limite superior:")
b = [Link]()
[Link]("Digite numeros de divisiones: ")
nd = [Link]()

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
[Link]("La integral es {0}", i)
[Link]()

[Link]()

Case 5

[Link](35, 23)
[Link]("Presione enter para volver a menú principal")

Dim col, fil As Integer

[Link] = 9
[Link](33, 12)
[Link]("SALIENDO DE PROGRAMA")

For col = 1 To 80 Step 1


[Link] = 15

[Link](col, 1)
[Link]("*")
[Link](col, 24)
[Link]("*")

Next
For fil = 1 To 24 Step 1
[Link] = 15
[Link](1, fil)
[Link]("*")
[Link](80, fil)
[Link]("*")

Next
[Link]()
[Link]()

End Select

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

Case 1
Dim col As Integer
Dim fil As Integer
Dim a, b As Integer
[Link](1, 26)
[Link]("Presione enter para cambiar de colores a
la cancha")

For a = 2 To 14
For col = 0 To 79
For fil = 0 To 23
[Link](col, fil)

[Link](" ")
[Link] = a
[Link]()

Next
Next

[Link] = 15
For col = 1 To 80 Step 1

[Link](col, 0)
[Link](" ")
[Link](col, 4)
[Link](" ")
[Link](col, 24)
[Link](" ")

Next

For col = 1 To 80 Step 1

[Link](col, 20)
[Link](" ")

Next

For col = 10 To 70 Step 1

[Link](col, 12)
[Link](" ")
Next
For fil = 1 To 24 Step 1

[Link](0, fil)
[Link](" ")
[Link](80, fil)
[Link](" ")
[Link](40, fil)
[Link](" ")

Next

For fil = 5 To 20 Step 1

[Link](10, fil)
[Link](" ")

[Link](70, fil)
[Link](" ")
Next

[Link]()
Next

[Link]()

[Link]()
[Link] = [Link]
[Link](" ")
Case 2

Dim col, fil As Integer

[Link](32, 1)
[Link]("LA TORRE DE HANOI")

For col = 10 To 70
For fil = 20 To 22
[Link](col, fil)
[Link] = [Link]
[Link](" ")
Next
Next
For col = 15 To 65
For fil = 17 To 19
[Link](col, fil)
[Link] = [Link]

[Link](" ")
Next
Next
For col = 20 To 60
For fil = 14 To 16
[Link](col, fil)
[Link] = [Link]
[Link](" ")
Next

Next
For col = 25 To 55
For fil = 11 To 13
[Link](col, fil)
[Link] = [Link]
[Link](" ")
Next

Next
For col = 30 To 50
For fil = 8 To 10
[Link](col, fil)
[Link] = [Link]
[Link](" ")
Next

Next
For col = 35 To 45
For fil = 5 To 7
[Link](col, fil)
[Link] = [Link]
[Link](" ")
Next

Next

[Link]()

[Link]()

[Link]()

Case 3

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


A = 0
B = -5

For col = 6 To 45
For fil = 1 To 24
[Link] = [Link]
[Link](col, fil)
[Link](" ")
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
[Link] = [Link]
[Link](col, fil)
[Link](" ")
Next
Next
For col = 1 + B To 5 + B
For fil = 4 To 6
[Link] = [Link]
[Link](col, fil)
[Link](" ")
Next
Next
For col = 1 + A To 5 + A
For fil = 7 To 9
[Link] = [Link]
[Link](col, fil)
[Link](" ")
Next
Next
For col = 1 + B To 5 + B
For fil = 10 To 12
[Link] = [Link]
[Link](col, fil)
[Link](" ")
Next
Next
For col = 1 + A To 5 + A
For fil = 13 To 15
[Link] = [Link]
[Link](col, fil)
[Link](" ")
Next
Next
For col = 1 + B To 5 + B
For fil = 16 To 18
[Link] = [Link]
[Link](col, fil)
[Link](" ")
Next
Next
For col = 1 + A To 5 + A
For fil = 19 To 21
[Link] = [Link]
[Link](col, fil)
[Link](" ")
Next
Next
For col = 1 + B To 5 + B
For fil = 22 To 24
[Link] = [Link]
[Link](col, fil)
[Link](" ")
Next
Next

Next
[Link] = [Link]
[Link](" ")
[Link]()
[Link]()

Case 4

Dim a, b, mult, c As Integer


[Link](32, 1)
[Link]("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

[Link](c, b + 1)
[Link]("{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
[Link](c, 12 + b)
[Link]("{0}x{1}={2}", a, b, mult)
[Link]()
Next
Next
[Link]()
Case 5
Dim col, fil As Integer
[Link](35, 23)
[Link]("Presione enter para volver a menú principal")

[Link] = 9
[Link](33, 12)
[Link]("SALIENDO DE PROGRAMA")

For col = 1 To 80 Step 1


[Link] = 15

[Link](col, 1)
[Link]("*")
[Link](col, 24)
[Link]("*")

Next
For fil = 1 To 24 Step 1
[Link] = 15
[Link](1, fil)
[Link]("*")
[Link](80, fil)
[Link]("*")

Next
[Link]()
[Link]()

End Select
[Link]()
Case 3
Dim col, fil As Integer

[Link] = 9
[Link](33, 12)
[Link]("SALIENDO DE PROGRAMA")

For col = 1 To 80 Step 1


[Link] = 15

[Link](col, 1)
[Link]("*")
[Link](col, 24)
[Link]("*")

Next
For fil = 1 To 24 Step 1
[Link] = 15
[Link](1, fil)
[Link]("*")
[Link](80, fil)
[Link]("*")

Next
[Link]()
[Link]()

End Select

End While
[Link]()
End Sub

End Module

You might also like