/***************************************** * Instructions * - Replace 'uwuserid' with your uWaterloo User ID * - Select the current calendar term and enter the year * - List students with whom you had discussions and who helped you * * uWaterloo User ID: uwuserid @uwaterloo.ca * Submitted for ECE 250 * Department of Electrical and Computer Engineering * University of Waterloo * Calender Term of Submission: (Winter|Spring|Fall) 201N * * By submitting this file, I affirm that * I am the author of all modifications to * the provided code. * * The following is a list of uWaterloo User IDs of those students * I had discussions with in preparing this project: * - * * The following is a list of uWaterloo User IDs of those students * who helped me with this project (describe their help; e.g., debugging): * - *****************************************/ #ifndef DYNAMIC_STACK_H #define DYNAMIC_STACK_H #ifndef nullptr #define nullptr 0 #endif #include "Exception.h" template class Dynamic_stack { private: int entry_count; int initial_capacity; int array_capacity; Type *array; public: Dynamic_stack( int = 10 ); Dynamic_stack( Dynamic_stack const & ); ~Dynamic_stack(); Type top() const; int size() const; bool empty() const; int capacity() const; void swap( Dynamic_stack & ); Dynamic_stack &operator=( Dynamic_stack const & ); void push( Type const & ); Type pop(); void clear(); }; template Dynamic_stack::Dynamic_stack( int n ): entry_count( 0 ), initial_capacity( n ), array_capacity( n ) { array = new Type[array_capacity]; } template Dynamic_stack::Dynamic_stack( Dynamic_stack const &stack ): entry_count( stack.entry_count ), initial_capacity( stack.initial_capacity ), array_capacity( stack.array_capacity ), array( new Type[array_capacity] ) { // The above initializations copy the values of the appropriate // member variables and allocate memory for the data structure; // however, you must still copy the stored objects. // Enter your implementation here. } template Dynamic_stack::~Dynamic_stack() { // Enter your implementation here. } template Type Dynamic_stack::top() const { // Enter your implementation here. return Type(); } template int Dynamic_stack::size() const { // Enter your implementation here. return 0; } template bool Dynamic_stack::empty() const { // Enter your implementation here. return true; } template int Dynamic_stack::capacity() const { // Enter your implementation here. return 0; } template void Dynamic_stack::swap( Dynamic_stack &stack ) { std::swap( entry_count, stack.entry_count ); std::swap( initial_capacity, stack.initial_capacity ); std::swap( array_capacity, stack.array_capacity ); std::swap( array, stack.array ); } template Dynamic_stack &Dynamic_stack::operator=( Dynamic_stack const &rhs ) { Dynamic_stack copy( rhs ); swap( copy ); return *this; } template void Dynamic_stack::push( Type const &obj ) { // Enter your implementation here. } template Type Dynamic_stack::pop() { // Enter your implementation here. return Type(); } template void Dynamic_stack::clear() { // Enter your implementation here. } #endif