Experimenting with Stacks

  • Write a program that uses a stack to reverse a sequence of words input by the user. Test it with the input, "YOU CAN CAGE A SWALLOW CAN'T YOU".
  • Add a PeekTop function (to return the top of the stack without removing it) to the Stack class and write code to call it from program StackClassDemo.
  • Confirm that you cannot write code to access the StrStack array directly from program StackClassDemo.
Programming - a skill for life!

Introduction to demonstrations of stacks