im making a program and when you select exit in the menu i want it to be like:

Are you sure you want to exit?

Yes No
Enter Esc

so when you press enter it will exit and when u press esc it will go back to the menu. everything iv tried didn't work. is it even possible to do this?

I have a procedure just made ....
:)

Program Program01;

Uses Crt;

Procedure ExitOrNot;
   Var C:Char;
   Begin
      WriteLn('Are sure you want to exit?');
      Write('Enter to quit or Esc to continue');
      C:=ReadKey;
      WriteLn;
      Case (C) Of
         #13:Halt;
         #27:Write('We are going back...');
      End;
   End;

Begin {main}
     {call our procedure...}
     ExitOrNot;

     ReadKey;
End.{main}

{
-= Note By FlamingClaw =-
#13 = Enter(from ascii)
#27 = Esc
-=Created By FlamingClaw=-
-=2009.03.20=-
}
commented: Helped me with a problem in pascal +1

thanks man! it worked! :)

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.