1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-09-04 11:10:15 +00:00
qb64/programs/samples/pete/calc_2.bas
SMcNeill 6e01fc8dce Altered string compare routines (<,<=,>,>=) so they don't give false results with CHR$(0).
Added new _STRCMP and _STRICMP commands for quick string comparisons.
Cleaned up QB64 to finish removing the QUI (quick user insert) code and folders.
Altered UCASE and LCASE routines to be faster in some situations for us.
2014-09-22 08:19:03 -04:00

68 lines
988 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