AntKrotov / oberon-07-compiler

Oberon-07 compiler for x64 (Windows, Linux), x86 (Windows, Linux, KolibriOS), MSP430x{1,2}xx, STM32 Cortex-M3
BSD 2-Clause "Simplified" License
61 stars 5 forks source link

Execution error after compiling #25

Open Spoiledpay opened 9 months ago

Spoiledpay commented 9 months ago

Dear all, this code was used to compile and receive input of 2 values ​​and add them. However, at the time of execution it generates an error window.

MODULE Soma;

IMPORT In, Out;

VAR numero1, numero2, resultado: INTEGER;

BEGIN Out.String("Enter the first number: "); In.Int(numero1);

Out.String("Enter the second number: "); In.Int(numero2);

resultado := numero1 + numero2;

Out.String("A soma é: "); Out.Int(resultado, 0); Out.Ln; END Soma.

Error

AntKrotov commented 9 months ago
  1. Before using 'In' module, you need to call 'In.Open' procedure: ... BEGIN In.Open; ( !!! ) Out.String("Enter the first number: "); In.Int(numero1); ...

  2. Also, to output Portuguese characters, try using 'Out.StringW' instead of 'Out.String' and save the source in utf-8-BOM encoding.