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


[ DelphiLand Discussion Forum ]

Posted by Kevin -=-Laaaaaaaaatttteeee on March 29, 2003 at 15:57:02:

In Reply to: Re: CAN ANY ONE RE-DO THIS TO MAKE IT MORE EASYER? posted by webmaster Guido on March 29, 19103 at 15:43:59:

: : 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;

Thank you But what else can you use instead of case mark of? or with the numbers can you change the format of them ?
Thankyou



Related Articles and Replies:



[ DelphiLand Discussion Forum ]