1. Engineering
  2. Computer Science
  3. stackh wrapper implemention based on singlelinked list class ifndef stackh...

Question: stackh wrapper implemention based on singlelinked list class ifndef stackh...

Question details

stack.h: wrapper implemention based on single-linked list class #ifndef STACK-H fde fine STACK-H include slinked class stack list.h - public: bool empty int size const return v.size empty) const f return v.empty : void push (const data t &din) v.push front (din) void pop) v.pop front const data t & top ) return v.front private: list v fendi f stack usagel.cpp: basic last-in, first-out example #include stack . h int main (int argc, char *argv[]) stack v int value; cout << enter values: while (cin >> value) v.push (value) cout << value <<n cout <<LIFO n while (!v.empty )) valuev.top O v.pop) cout << value <<In
See the stack handout for the class definition and wrapper implementation of a stack based on a list. Your task is to replace the wrapper implementation with code based on a dynamically allocated array. Assume the data stored on the stack are simple integers (int). Implement the public member functions stack(), stack(), empty), size), push0, pop) and top().Single line functions may be defined within the class if you like. Multi-line functions should be defined outside of the dlass definition. The constructor initializes all member variables and allocates memory for the array. The destructor deallocates the array memory. Make the size of the array 10. Do not include resizing. Do not include any error checking. Problem 2 13] What type of error checking should member functions push(), pop() and top() include if the code were to be used in real application?
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution