Queue Application: Palindrom

We want to write a program that tests a string for being a Palindrom, i.e. a word or sentence(s) that reads forwards the same as backwards (e.g. 'otto').

Groups 1 and 2 have together created the implementation for the ADT Queue, while Group 3 has created two procedures for our application:

Procedure PutInStack(var S: Stack; exp: string);
  { PRE:  exp is a non-empty string of characters }
  { POST: each character in exp has been push into the }
  {       stack, from first to last.                   }
Procedure PutInQueue(var Q: Queue; exp: string); 
  { PRE:  exp is a non-empty string of characters }
  { POST: each character in exp has been enqueued into }
  {       the queue, from first to last.               }

The final assigmnent is to write a main program called Palindrom that uses WinCRT, Stacks, Queues and the above procedures to test whether a string is a palindrom or not. The program should ask the user to enter a string, determine whether the string is a palindrom or not, and inform the user of the result.

You can retrieve the various pieces for the Queues unit from the bulletin board, as well as the above two routines. In addition, I have posted a unit Stacks on the bulletin board that you can also download. Finally, to make your life easier, I have also posted a routine

Function AreTheSame(Q: Queue, S: Stack): boolean;
   {PRE:  Q is a non-empty queue, S is a non-empty Stack }
   {      Q and S contain the same number of elements    }
   {POST: The function returns 'true' if Q and S contain }
   {      the same elements, 'false' otherwise.          }

After you download all these pieces, your main program is pretty easy. It should look basically like this:

   PROGRAM Palindrom;
   USES
	WinCRT, Stacks, Queues;
   { ... }
   PROCEDURE PutInStack{ ... }
   PROCEDURE PutInQueue{ ... }
   FUNCTION AreTheSame{ ... }

   BEGIN
       { ... }
   END

The complete program Palindrom is due Monday !.