PUBLIC ban AS Integer
PUBLIC aux1 AS Integer
PUBLIC aux AS Integer
PUBLIC compunto AS Integer
'PUBLIC cadena AS String
'PUBLIC cadena2 AS String
PUBLIC SUB Form_Open()
END
PUBLIC SUB Button12_Click()
ban = 1
IF visor.text <> 0 THEN
aux1 = visor.text
ELSE
aux1 = 0
ENDIF
visor.clear
END
PUBLIC SUB Button8_Click()
visor.text = visor.text & "1"
END
PUBLIC SUB Button9_Click()
visor.text = visor.text & "2"
END
PUBLIC SUB Button10_Click()
visor.text = visor.text & "3"
END
PUBLIC SUB Button4_Click()
visor.text = visor.text & "4"
END
PUBLIC SUB Button5_Click()
visor.text = visor.text & "5"
END
PUBLIC SUB Button6_Click()
visor.text = visor.text & "6"
END
PUBLIC SUB Button1_Click()
visor.text = visor.text & "7"
END
PUBLIC SUB Button2_Click()
visor.text = visor.text & "8"
END
PUBLIC SUB Button3_Click()
visor.text = visor.text & "9"
END
PUBLIC SUB Button7_Click()
visor.text = visor.text & "0"
END
PUBLIC SUB Button11_Click()
visor.text = visor.text & "."
END
PUBLIC SUB Button17_Click()
visor.clear
END
PUBLIC SUB Button16_Click()
ME.CLOSE
END
PUBLIC SUB Button13_Click()
ban = 2
IF visor.text <> 0 THEN
aux1 = visor.text
ELSE
aux1 = 0
ENDIF
visor.clear
END
PUBLIC SUB Button14_Click()
ban = 3
IF visor.text <> 0 THEN
aux1 = visor.text
ELSE
aux1 = 0
ENDIF
visor.clear
END
PUBLIC SUB Button15_Click()
ban = 4
IF visor.text <> 0 THEN
aux1 = visor.text
ELSE
aux1 = 0
ENDIF
visor.clear
END
PUBLIC SUB Button18_Click()
IF visor.text <> 0 THEN
aux = visor.text
ELSE
aux = 0
ENDIF
visor.text = operaciones(ban, aux1, aux)
END
PUBLIC FUNCTION operaciones(opera AS Integer, v1 AS Integer, v2 AS Integer) AS Integer
DIM respuesta AS Integer
DIM i AS Integer
DIM acumula AS Integer
SELECT CASE opera
CASE 1
respuesta = v1 + v2
CASE 2
respuesta = v1 - v2
CASE 3
respuesta = v1 * v2
CASE 4
IF v2 = 0 THEN
respuesta = v1 / v2
Message("dividir para cero informacion")
ENDIF
CASE 5
acumula = 1
FOR i = 1 TO v2
acumula = acumula * v1
NEXT
respuesta = acumula
END SELECT
RETURN respuesta
END
PUBLIC SUB Button19_Click()
visor.Text = visor.text * visor.Text
END
PUBLIC SUB Button21_Click()
IF visor.Text <> "" THEN
compunto = 0
ban = 5
IF visor.Text <> 0 THEN
aux1 = visor.Text
ELSE
aux1 = 0
ENDIF
visor.Clear
ENDIF
END
PUBLIC SUB Button20_Click()
visor.Text = visor.Text * visor.Text * visor.Text
END
PUBLIC SUB Button28_Click()
END
PUBLIC SUB Button23_Click()
visor.Text = Sin(visor.Text)
END
PUBLIC SUB Button24_Click()
visor.Text = Cos(visor.Text)
END
PUBLIC SUB Button25_Click()
visor.Text = Tan(visor.Text)
END
PUBLIC SUB Button32_Click()
DIM c, oc1, oc2, i AS Integer
DIM cadena, cadena2 AS String
c = visor.Text
WHILE c > 0
oc1 = (Int(c / 8))
oc2 = c MOD 8
cadena = cadena & Str(oc2)
c = oc1
WEND
FOR i = Len(cadena) TO 1 STEP - 1
cadena2 = cadena2 & Mid(cadena, i, 1)
NEXT
visor.Text = cadena2
END
PUBLIC SUB Button33_Click()
DIM n, i, x1, x2 AS Integer
DIM cadena, cadena2 AS String
n = visor.Text
WHILE n > 0
x1 = (Int(n / 16))
x2 = n MOD 16
IF x2 < 10 THEN cadena = cadena & Str(x2) ELSE IF x2 = 10 THEN cadena = cadena & "A" ELSE IF X2 = 11 THEN cadena = cadena & "B" ELSE IF x2 = 12 THEN cadena = cadena & "C" ELSE IF X2 = 13 THEN cadena = cadena & "D" ELSE IF x2 = 14 THEN cadena = cadena & "E" ELSE IF X2 = 15 THEN cadena = cadena & "F" ENDIF n = x1 WEND FOR i = Len(cadena) TO 1 STEP -1 cadena2 = cadena2 & Mid(cadena, i, 1) NEXT visor.Text = cadena2 END PUBLIC SUB Button22_Click() END PUBLIC SUB Button26_Click() END PUBLIC SUB Button30_Click() END PUBLIC SUB Button29_Click() DIM i AS Integer FOR i = 1 TO visor.Text IF i <> visor.text
visor.text = i
ENDIF
NEXT
END