[fpc-devel] readln problem
L
L at z505.com
Mon Oct 29 15:38:03 CET 2007
> 2.Second example - it does not work.
>
> program NUMBERS (Input,Output);
> var A,B : Integer;
> begin
> Write ('Find greater number.');
> Write ('Enter two numbers.');
> Read (A,B);
> if A>B then
> Write ('The greater number is',A)
> else
> Write ('The greater number is',B);
> readln;
>
> end.
>
>
> Could anybody tell me why it does not work?
> Thanks a lot
This should probably be on the fpc-pascal mailing list rather than devel.
Something like this solves your problem
program NUMBERS (Input,Output);
var A,B : Integer;
begin
Write ('Find greater number.');
Write ('Enter two numbers.');
Read (A,B);
if A>B then Write ('The greater number is ',A)
else
Write ('The greater number is ',B);
readln;
readln;
end.
Because you must hit enter twice.. once after the first read, then once to end
the program.
More information about the fpc-devel
mailing list