IDENTIFICATION DIVISION.
PROGRAM-ID. PROG025.
AUTHOR FERNANDO CARRARO.
INSTALLATION. CODEMONKEYJUNIOR.
DATE-WRITTEN. 18/04/19.
DATE-COMPILED.
SECURITY. NO ES CONFIDENCIAL.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-OPC PIC X(8).
01 WS-RESULTADO PIC S9(7)V99 VALUE 0.0.
01 WS-CONSTANTE-A PIC 9(7)V99 VALUE 0.55.
01 WS-CONSTANTE-B PIC 9(7)V99 VALUE 1.8.
01 WS-VALOR PIC S9(7)V99 VALUE 12.00.
PROCEDURE DIVISION.
MAIN.
DISPLAY "CALCULADORA".
DISPLAY "F. FAHRENHEIT | C.CELSIUS"
DISPLAY "INTRODUCE OPCION:".
ACCEPT WS-OPC.
DISPLAY "TU OPCION ES: "WS-OPC.
IF WS-OPC = "F" OR WS-OPC = "f"
PERFORM FAHRENHEIT
END-IF.
IF WS-OPC = "C" OR WS-OPC ="c"
PERFORM CELSIUS
END-IF.
STOP RUN.
FAHRENHEIT.
COMPUTE WS-RESULTADO = (WS-VALOR * WS-CONSTANTE-B) + 32.
DISPLAY "FAHRENHEIT = "WS-RESULTADO.
CELSIUS.
COMPUTE WS-RESULTADO = (WS-VALOR - 32) * WS-CONSTANTE-A.
DISPLAY "CELSIUS = "WS-RESULTADO.
Uso de IF en COBOL.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.