1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-06 03:30:23 +00:00
QB64-PE/tests/qbasic_testcases/pete/calc_2.bas
Matthew Kilgore 9ee89d6ff4 Add QBasic tests
These tests use a variety of sample code (with some of the larger files
removed, so they are not complete!) and verifies that they all compile
successfully.
2022-04-28 23:00:07 -04:00

69 lines
920 B
QBasic

DECLARE SUB CentrarTexto (t$, y%)
ini:
CLS
COLOR 9
CentrarTexto "L.M.S Calculadora", 3
COLOR 15, 1
CentrarTexto " 1. Sumar ", 5
CentrarTexto " 2. Restar ", 6
CentrarTexto " 3. Dividir ", 7
CentrarTexto " 4. Multiplicar", 8
CentrarTexto " 5. Salir ", 9
COLOR 4, 0
LOCATE 11, 32
INPUT "Numero de opci¢n:", opci
SELECT CASE opci
CASE 1
CASE 2
CASE 3
CASE 4
CASE 5
END
CASE ELSE
GOTO ini
END SELECT
CLS
COLOR 15
INPUT "Numero 1: ", num1
INPUT "Numero 2: ", num2
SELECT CASE opci
CASE 1
resultado = num1 + num2
CASE 2
resultado = num1 - num2
CASE 3
resultado = num1 / num2
CASE 4
resultado = num1 * num2
CASE 5
END
CASE ELSE
GOTO ini
END SELECT
COLOR 10
PRINT
PRINT "Resultado = ", resultado
DO WHILE INKEY$ = ""
LOOP
GOTO ini
SUB CentrarTexto (t$, y%)
xnum% = (80 - LEN(t$)) / 2
xspc% = INT((80 - LEN(t$)) / 2)
IF y% = 0 THEN PRINT TAB(xspc%); t$: EXIT SUB
LOCATE y%, xnum%: PRINT t$
'
END SUB