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:
- Implemented a templated class.
- Tested this class.
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
- Makefile
- stackTest.cpp
- StackT.cpp You probably don't need this one unless your implementation did not work.
- StackT.h This is mine, use it only if yours did not work.
Required Files
A single tar or zip file containing the source code and makefile for this program.
Submission
Submit the assignment to the D2L folder hw3 by the due date.