REM
REM Demo calculator program
REM PvE - March 2009.
REM Revised May 2010.
REM

PRINT NL$, "-= BACON Calculator =-", NL$

REM Make sure to use doubles
DECLARE f, g TYPE float

REM Endless loop
WHILE TRUE

    REPEAT
        PRINT "1) Perform addition"
        PRINT "2) Perform substraction"
        PRINT "3) Perform multiplication"
        PRINT "4) Perform division"
        PRINT "5) Quit"
        PRINT
        PRINT "Enter your choice... ";

        key = GETKEY

    UNTIL key > 48 AND key < 54

    PRINT

    REM Check if user quits
    IF key EQ 53 THEN
        PRINT "Thanks for using this calculator!"
        BREAK
    ENDIF

    REM Addition
    IF key EQ 49 THEN

        INPUT "Enter first number: ", f
        INPUT "Enter second number: ", g

        PRINT NL$, "Result is: ", f + g, NL$
    ENDIF

    REM Substraction
    IF key EQ 50 THEN

        INPUT "Enter first number: ", f
        INPUT "Enter second number: ", g

        PRINT NL$, "\nResult is: ", f - g, NL$
    ENDIF

    REM Multipication
    IF key EQ 51 THEN

        INPUT "Enter first number: ", f
        INPUT "Enter second number: ", g

        PRINT NL$, "Result is: ", f * g, NL$
    ENDIF

    REM Division
    IF key EQ 52 THEN

        INPUT "Enter first number: ", f
        INPUT "Enter second number: ", g

        PRINT NL$, "Result is: ", f / g
    ENDIF

WEND