Re: CAN ANY ONE RE-DO THIS TO MAKE IT MORE EASYER?


[ DelphiLand Discussion Forum ]

Posted by webmaster Guido on March 29, 2003 at 15:43:59:

In Reply to: CAN ANY ONE RE-DO THIS TO MAKE IT MORE EASYER? posted by Kevin Walters :-) on March 29, 19103 at 11:01:12:

: Can anyone re=do this without changing the basic layout?
: Thanks
: Kev : Laaaaaattttteeeeeee

: procedure displayGrade(mark : integer);
: begin
: case mark of
: 0..49 : writeln('Fail');
: 50..64: writeln('Pass');
: 65..79: writeln('Credit');
: 80..100:writeln('Honours');
: else
: writeln('invalid entry');
: end; //case
: end;

: var
: Grade : integer;
: begin
: repeat
: Write('Enter Grade or mark (-1 to stop) >');
: readln(Grade);
: if Grade <> stop then
: displayGrade(Grade);
: until Grade = stop
: end.
------------------

What do you mean by "redo this"? I think that this code can not be simplified, by leaving out whatever part you would break it.

But there is one statement missing, you have to declare "Stop". Add this right before the "var" statement:

const
Stop = -1;



Related Articles and Replies:


[ DelphiLand Discussion Forum ]