oberon-07-compiler icon indicating copy to clipboard operation
oberon-07-compiler copied to clipboard

Execution error after compiling

Open Spoiledpay opened this issue 1 year ago • 1 comments

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

Spoiledpay avatar Nov 22 '23 23:11 Spoiledpay

  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.

AntKrotov avatar Nov 23 '23 08:11 AntKrotov