oberon-07-compiler
oberon-07-compiler copied to clipboard
Execution error after compiling
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.
-
Before using 'In' module, you need to call 'In.Open' procedure: ... BEGIN In.Open; (* !!! *) Out.String("Enter the first number: "); In.Int(numero1); ...
-
Also, to output Portuguese characters, try using 'Out.StringW' instead of 'Out.String' and save the source in utf-8-BOM encoding.