954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

needing help really fast

Hi!
First of all i know you don't help with homework to those that are not trying to solve it themselves but I REALLY TRIED...i am Embarrassed to say but I am trying to do this for few days already and my deadline for homework is getting close and I need to give result.
So I am asking you please please to help me with this :)

This is my task…
I made it this way only my assistant told me that it is correct BUT he needs it other way…
This is program I made

program toy;
uses crt;
VAR option : integer;

procedure ShowMenu;

begin

writeln('+------------------+');
writeln('| MENU |');
writeln('+------------------+');
writeln('| Options: |');
writeln('| 1=laughs |');
writeln('| 2=cries |');
writeln('| 3=sings |');
writeln('| 0=sleeps |');
writeln('+------------------+');

end;

procedure ChooseOption;

Begin

if option=1 then writeln('Toy is laughing!') else
if option=2 then writeln('Toy is crying!') else
if option=3 then writeln('Toy is singing!') else
writeln('The option you chose does not exist!');
delay(2000);
write('Choose option: ');
read(option);
readln;
end;

begin

ShowMenu;
write('Choose option: ');
read(option);
while option<>0 do
ChooseOption;
writeln('Toy is sleeping!');
readln;

end.
--------

so....what he wants is we to make a procedure that takes a parameter (which i tried and tried and tried and can't get it at all) and that parameter is the value of option and it will print out on screen same as i got..
i realllllyyyy tried but only i reached the point where it prints on my screen same ...for example toy is laughing ..and hundreds like that...
please please help :)

thanks a lot

Me_Myself
Newbie Poster
1 post since Mar 2005
Reputation Points: 10
Solved Threads: 0
 
program toy;
var
   Option : Integer;

procedure ShowMenu;
begin
   writeln;
   writeln( '+------------------+' );
   writeln( '|       MENU       |' );
   writeln( '+------------------+' );
   writeln( '|     Options:     |' );
   writeln( '|     0=sleeps     |' );
   writeln( '|     1=laughs     |' );
   writeln( '|     2=cries      |' );
   writeln( '|     3=sings      |' );
   writeln( '|     4=exit       |' );
   writeln( '+------------------+' );
   writeln;
end;

procedure ShowMessage( Option: Integer );
begin
   case Option of
      0: writeln( 'Toy is sleeping!' );
      1: writeln( 'Toy is laughing!' );
      2: writeln( 'Toy is crying!' );
      3: writeln( 'Toy is singing!' );
   else
      writeln( 'The Option you chose does not exist!' );
   end;
end;

begin
   ShowMenu;
   read( Option );
   while Option <> 4 do
   begin
      ShowMessage( Option );
      read( Option );
   end;
end.
Jackrabbit
Light Poster
31 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

Hello,

I removed the two posts concerning the argument / attitude of the situation that are not relevant to the solution. Let's try to remain focused on the technical aspects of the discussion, and leave our assumptions off the website.

Thank you.

Christian

kc0arf
Posting Virtuoso
Team Colleague
1,937 posts since Mar 2004
Reputation Points: 121
Solved Threads: 57
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You