Homework 3, Templated Stack with Exceptions.

Short Description:

Implement a templated stack class which throws exceptions when pop and top are called inappropriately. Test this implementation.

Goals

When you finish this homework, you should have:

Formal Description

Change your stack class from homework one to be a templated class. This should be implemented in a single file StackT.h. If you did not successfully implement the stack class, mine is provided below for your reference.

Change the error behavior to throw an out_of_range exception rather than printing an error and returning erroneous data. The verbiage in the exception should match the previous verbiage.

Check this with my stackTest.cpp file. Your program should run with no errors or memory leaks and must compile against this program unaltered.

Write a test driver that demonstrates your stack works with at least two other data types. Do not just copy my driver and change the types.

Useful Files