Visual Basic Module graduado desde Small Basic


a1

Este ejercicio es una prueba de operaciones matemáticas, codificado en Small Basic y convertido a VB.NET con la función “graduar”

matModule

Dim endl, aux, e, pi, rad, i AsPrimitive

Sub Main()

‘ Prueba con operaciones matemáticas

‘—————————————————-

TextWindow.Title = “Prueba con operaciones matemáticas”

endl =

Text.GetCharacter(13) ‘\n

endl = endl +

Text.GetCharacter(10) ‘\r

‘—————————————————-

aux =

“Abs(8)       = “ + Microsoft.SmallBasic.Library.Math.Abs(8)

TextWindow.WriteLine(aux)

aux =

“Abs(-8)      = “ + Microsoft.SmallBasic.Library.Math.Abs(-8)

TextWindow.WriteLine(aux)

TextWindow.Write(endl)

‘—————————————————-

aux =

“Round(4.4)   = “ + Microsoft.SmallBasic.Library.Math.Round(4.4)

TextWindow.WriteLine(aux)

aux =

“Round(4.6)   = “ + Microsoft.SmallBasic.Library.Math.Round(4.6)

TextWindow.WriteLine(aux)

aux =

“Round(4.5)   = “ + Microsoft.SmallBasic.Library.Math.Round(4.5)

TextWindow.WriteLine(aux)

aux =

“Round(5.5)   = “ + Microsoft.SmallBasic.Library.Math.Round(5.5)

TextWindow.WriteLine(aux)

aux =

“Ceiling(3.5) = “ + Microsoft.SmallBasic.Library.Math.Ceiling(3.5)

TextWindow.WriteLine(aux)

aux =

“Floor(3.5)   = “ + Microsoft.SmallBasic.Library.Math.Floor(3.5)

TextWindow.WriteLine(aux)

TextWindow.Write(endl)

‘—————————————————-

e = 2.7182818284590452354

aux =

“e            = “ + e

TextWindow.WriteLine(aux)

aux =

“Ln(e)        = “ + Microsoft.SmallBasic.Library.Math.NaturalLog(e)

TextWindow.WriteLine(aux)

aux =

“Log(10)      = “ + Microsoft.SmallBasic.Library.Math.Log(10.0)

TextWindow.WriteLine(aux)

TextWindow.Write(endl)

‘—————————————————-

aux =

” 7 ^ 11      = “ + Microsoft.SmallBasic.Library.Math.Power(7, 11)

TextWindow.WriteLine(aux)

aux =

“23 ^ (1/2)   = “ + Microsoft.SmallBasic.Library.Math.SquareRoot(23)

TextWindow.WriteLine(aux)

TextWindow.Write(endl)

TextWindow.Pause()

TextWindow.Clear()

‘—————————————————-

pi = Microsoft.SmallBasic.Library.

Math.Pi

aux =

“Pi = “ + pi

TextWindow.WriteLine(aux)

TextWindow.Write(endl)

‘—————————————————-

rad = 0

aux =

“0        radianes = “ + Microsoft.SmallBasic.Library.Math.GetDegrees(rad)

TextWindow.WriteLine(aux)

rad = pi / 2

aux =

“Pi / 2   radianes = “ + Microsoft.SmallBasic.Library.Math.GetDegrees(rad)

TextWindow.WriteLine(aux)

rad = pi

aux =

“Pi       radianes = “ + Microsoft.SmallBasic.Library.Math.GetDegrees(rad)

TextWindow.WriteLine(aux)

rad = pi * 3 / 2

aux =

“3 Pi / 2 radianes = “ + Microsoft.SmallBasic.Library.Math.GetDegrees(rad)

TextWindow.WriteLine(aux)

rad = pi * 2

aux =

“2 Pi     radianes = “ + Microsoft.SmallBasic.Library.Math.GetDegrees(rad)

TextWindow.WriteLine(aux)

TextWindow.Write(endl)

‘—————————————————-

aux =

”  0 º = “ + Microsoft.SmallBasic.Library.Math.GetRadians(0)

TextWindow.WriteLine(aux)

aux =

” 90 º = “ + Microsoft.SmallBasic.Library.Math.GetRadians(90)

TextWindow.WriteLine(aux)

aux =

“180 º = “ + Microsoft.SmallBasic.Library.Math.GetRadians(180)

TextWindow.WriteLine(aux)

aux =

“270 º = “ + Microsoft.SmallBasic.Library.Math.GetRadians(270)

TextWindow.WriteLine(aux)

aux =

“360 º = “ + Microsoft.SmallBasic.Library.Math.GetRadians(360)

TextWindow.WriteLine(aux)

TextWindow.Write(endl)

TextWindow.Pause()

TextWindow.Clear()

‘—————————————————-

For i = 0 To 360 Step 18

rad = Microsoft.SmallBasic.Library.

Math.GetRadians(i)

If i < 10 Then

aux =

“Cos(“ + i + “)   = “

ElseIf i < 100 Then

aux =

“Cos(“ + i + “)  = “

Else

aux =

“Cos(“ + i + “) = “

EndIf

aux = aux + Microsoft.SmallBasic.Library.

Math.Cos(rad)

TextWindow.WriteLine(aux)

Next

TextWindow.Write(endl)

TextWindow.Pause()

TextWindow.Clear()

For i = 0 To 360 Step 18

rad = Microsoft.SmallBasic.Library.

Math.GetRadians(i)

If i < 10 Then

aux =

“Sin(“ + i + “)   = “

ElseIf i < 100 Then

aux =

“Sin(“ + i + “)  = “

Else

aux =

“Sin(“ + i + “) = “

EndIf

aux = aux + Microsoft.SmallBasic.Library.

Math.Sin(rad)

TextWindow.WriteLine(aux)

Next

TextWindow.Write(endl)

TextWindow.Pause()

TextWindow.Clear()

For i = 0 To 360 Step 18

If (i <> 90) And (i <> 270) Then

rad = Microsoft.SmallBasic.Library.

Math.GetRadians(i)

If i < 10 Then

aux =

“Tan(“ + i + “)   = “

ElseIf i < 100 Then

aux =

“Tan(“ + i + “)  = “

Else

aux =

“Tan(“ + i + “) = “

EndIf

aux = aux + Microsoft.SmallBasic.Library.

Math.Tan(rad)

Else

If i = 90 Then

aux =

“Tan(90)  = Infinito”

Else

aux =

“Tan(270) = -Infinito”

EndIf

EndIf

TextWindow.WriteLine(aux)

Next

TextWindow.Write(endl)

TextWindow.Pause()

TextWindow.Clear()

‘—————————————————-

aux =

“37 % 42 = “ + Microsoft.SmallBasic.Library.Math.Remainder(37, 42)

TextWindow.WriteLine(aux)

TextWindow.Write(endl)

‘—————————————————-

aux =

“Max(9, 8) = “ + Microsoft.SmallBasic.Library.Math.Max(9, 8)

TextWindow.WriteLine(aux)

aux =

“Max(4, 6) = “ + Microsoft.SmallBasic.Library.Math.Max(4, 6)

TextWindow.WriteLine(aux)

TextWindow.Write(endl)

aux =

“Min(9, 8) = “ + Microsoft.SmallBasic.Library.Math.Min(9, 8)

TextWindow.WriteLine(aux)

aux =

“Min(4, 6) = “ + Microsoft.SmallBasic.Library.Math.Min(4, 6)

TextWindow.WriteLine(aux)

TextWindow.Write(endl)

‘—————————————————-

For i = 1 To 10

aux =

“Random()  = “ + Microsoft.SmallBasic.Library.Math.GetRandomNumber(10)

TextWindow.WriteLine(aux)

Next

TextWindow.Write(endl)

EndSub

End

Module

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s