Using a Stack:
Write a segment of code (preferably a separate subroutine)
to perform each of the following operations.
You should #include StackType.h, and add StackType.cpp to your project so that you can use any
of the member functions of StackType. The details of the stack type are
encapsulated (you do not have access to them and CANNOT add other member
functions). You may declare as many
stack objects as you wish.
- Create
a stack that holds the characters that are in the file stackdata. Set a variable called secondElement
to the second element in the stack (from the top), leaving the stack
without the first two elements.
- Make a
copy of the stack, leaving the stack unchanged.
- Set the
variable bottom to the
bottom element in the stack leaving the stack unchanged.
- Set bottom to the bottom element in
the stack, leaving the stack empty.