[fpc-pascal]FreePascal rudely shuts down when I try to compile this particular code
JONATHAN GOLD
jonathangold at usa.net
Sun May 6 23:04:43 CEST 2001
I am having an odd problem. The following code may have bugs, but I cannot
tell, as this is what keeps happening: whenever I try to compile this code (
Alt + F9 ) something flashes very fast on the screen and then FreePascal
abruptly closes down! (Incidentally this code is from a tutorial I am reading,
though I've changed its name.)
Program JustInCase (input, output);
var
invalid_operator : boolean;
operator : char;
num1, num2, result : real;
begin
invalid_operator := FALSE;
writeln('Enter two numbers and an operator in the format');
writeln(' number1 operator number2');
readln( num1 ); readln( operator ); readln( num2 );
case operator of
'*' : result := num1 * num2;
'/' : result := num1 / num2;
'+' : result := num1 + num2;
'-' : result := num1 - num2;
otherwise invalid_operator := TRUE;
if invalid_operator then
writeln('Invalid operator')
else
writeln(num1:4:2, ' ',operator,' ', num2:4:2, ' is
',result:5:2) {this line isn't wrapped on my screen}
end.
I have tried writing any other program, some simple calculation, and it
compiles fine, giving me error messages where necessary, but it doesn't rudely
shut down. But every time I try to compile the above it rudely shuts down. Is
there something in this code as written that is telling it to shut down??
Thanks for any advice,
Jonathan Gold
jonnygee at pacbell.net
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1
More information about the fpc-pascal
mailing list