This Is My Code:-

Begin

  gotoxy(31,1);
  write('Peters Petrol Pump');
  gotoxy(31,2);
  write('==================');

  gotoxy(0,4);
  write('Welcome To Peters Petrol Pump...Here Are Your Options:-');
  gotoxy(5,6);
  write('1. Console');
  gotoxy(5,7);
  write('2. Petrol Pump');
  gotoxy(5,8);
  write('3. Exit');
  gotoxy(0,10);
  write('Please Select An Option...');
  read(StartingAnswer);

  if StartingAnswer =1 then
   Begin
    clrscr;
    gotoxy(30,11);
    write('Under Construction');

     repeat
      gotoxy(30,12);
      write('Press Enter To Exit');
     until Keypressed;

     [B]{Need To Get Back To Main Menu}[/B]

   End;

End.

^^^That Is Just A Little Bit Of My Code.

But what i was wondering was where it says '{Need To Get Back To Main Menu}' how would i get back to that main menu?

i think i have been taught this but i have forgot, looks simple.

Thank You
:)

You need a loop. Like repeat..until or while..do.

You can also check your answers using a case statement.

i already have a repeat loop,

where would i put the second loop

i already have a repeat loop,

where would i put the second loop

Member Avatar for Micheus

Made use from procedures. To menu, use CASE like Duoas sugest You and try some thing lik this:

procedure ProcessMenu;
begin
  clrscr;
  gotoxy(31,1);
  write('Peters Petrol Pump');
  gotoxy(31,2);
  write('==================');

  gotoxy(0,4);
  write('Welcome To Peters Petrol Pump...Here Are Your Options:-');
  gotoxy(5,6);
  write('1. Console');
  gotoxy(5,7);
  write('2. Petrol Pump');
  gotoxy(5,8);
  write('3. Exit');
  gotoxy(0,10);
  write('Please Select An Option...');
  read(StartingAnswer);
end;

Begin
  StartingAnswer := 0;
  While StartingAnswer <> 3 Do
  Begin 
    ProcessMenu;
    Case StartingAnswer Of
      1 :
        Begin
          clrscr;
          gotoxy(30,11);
          write('Under Construction');

          repeat
            gotoxy(30,12);
            write('Press Enter To Exit');
          until Keypressed;
        End;
      2 : 
        Begin
          ...
        End;  
       ...
     End;
  End;
End.

Bye

thanks for the help mate i got it working :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.