/**
 * Stack.cpp - This file uses the C++ STL stack API and implements a
 *            helper function called reverse that will reverse a
 *            given stack.
 *
 * TODO: Include your name and course number here.
 */

#include <iostream>
#include <cstdio>
#include <string>
#include <stack>

using namespace std;

template <class Object>
void print(stack<Object> myStack);

template <class Object>
void reverseStack(stack<Object> &myStack);

int main()
{
   stack<string> myStack;

   myStack.push("the");
   myStack.push("quick");
   myStack.push("brown");
   myStack.push("fox");
   myStack.push("jumped");

   cout << "The contents of myStack:" << endl;
   print(myStack);

   cout << "The reverse of myStack:" << endl;
   reverseStack(myStack);
   print(myStack);

   cout << "** Press any key to continue **";
   getchar();

   return 0;
} 

template <class Object>
void print(stack<Object> myStack)
{
   stack<Object> tmpStack;

   tmpStack = myStack;

   while (!tmpStack.empty())
   {
      // Print the top item that is on the stack
      cout << " " << tmpStack.top() << endl; 

      // Pop the item off of the stack
      tmpStack.pop();
   }

   cout << endl;

   return;
}

template <class Object>
void reverseStack(stack<Object> &myStack)
{
   // TODO: Implement the details for the reverseStack function.

   return;
}

