[fpc-pascal]FreePascal rudely shuts down when I try to compile this particular code
Carlo Kok
ckok.1 at hccnet.nl
Sun May 6 23:17:24 CEST 2001
----- Original Message -----
From: "JONATHAN GOLD" <jonathangold at usa.net>
To: <fpc-pascal at lists.freepascal.org>
Cc: <jonnygee at pacbell.net>
Sent: Sunday, May 06, 2001 11:04 PM
Subject: [fpc-pascal]FreePascal rudely shuts down when I try to compile this
particular code
> 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.)
I don't know why it abruptly closes but:
>
> 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;
Otherwise is not valid Free Pascal (afaik). It should be:
Else Invalid_Operator := True;
end;
> 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
More information about the fpc-pascal
mailing list