Array based stack


copy over all the provided files


for this lab you will produce a menu driven main and 3 test files to test some functions on the standard template library stack.



This main will be the foundation for the main to test ALL of your upcoming homework. 
It is requred that you be able to redirect in input commands from a file. 
In order for you program to work you should not use std::cin. 
There are a couple functions in cmpslib.h that will clean up user input and make writing your main much simpler.

inline void Prompt (string prompt, T & val)
inline void Prompt( string prompt,T& val, T minval, T maxval)

It is YOUR responstibilty to make sure that your (stack, queue, linked list ....) work properly.
You will produce a menu driven main so to ease testing but then you must also test your code and make sure that it works. 

NOTE: NONE of your containers should ever cause an segmentaion fault. And your main should NEVER have any tests in it to try to prevent it.
For example in this lab if you call top on an empty stack you will get a segmentation fault because that is what happens. Make sure your main works
EXACTLY like the example. Your menu driven main should not provide any logic to try to prevent calling a function if the user input says to call the function.
All logic to prevent errors should be in your container... ie your stack top function instead of having a segmentation fault you should throw an exception 


Simply put for all your upcoming menu driven assignments your code must perform EXACTLY like the examples when you redirect in all the provided test files.
If it does not match exactly you will not get full credit.
ALSO: just because it works with all my provided test files DOES NOT mean your stack works properly.. I generally grade them with even more complex test files than the ones I provide for you... The only time it is my responsibilty to test your code for you is when i grade it, prior to that it is YOUR responsibilty to test it.




in your stack homework you will create your own stack class , 
in this lab we will use the stack implementation of the standard template library, 
stl::stack



it is crucial that  your test main for the labs and homework should behave exactly like this one
AND that it behaves the same when you redirect in the user input from a file.

I WILL test and grade your stack by reidirecting in a file conatining the keystrokes to perform many different function calls






This lab will provide a base for the menu driven mains to test many of the container classes we will produce moving forward
Stack, Queue, Linked List and Binary Search Tree will all use this method of testing


Your main should work exactly like the examples
and should work for multiple data types


in order to make sure there will be several test files to try against your menu driven program

instead of typing in a bunch of commands to the menu driven main we can redirect a file 


./runme_int < testfiles/testinput1_int 
should have the exact same ouput as 
./example_int < testfiles/testinput1_int 


./runme_string  < testfiles/testinput1_string 
should have the exact same ouput as 
./example_string < testfiles/testinput1_string


./runme_fraction < testfiles/testinput3_fraction
should have the exact same ouput as 
./example_fraction < testfiles/testinput3_fraction



you will make 3 files mytestfile_int, mytestfile_fraction  and mytestfile_string

add 5 values,
call top then delete  , 5 times ( on your homeworks you will want to delete more than you inserted to be sure )
add 5 different values
call size 
call top then delete  , 5 times
call size


you should also be able to chain commands together 
sei50ti40ti60tsddex