Question: Problem 1 See the stack_handoutfor the class definitionand wrapper implementationof a stack based on a list.Your task is to replace the wrapper implementation with code

Problem 1

See the stack_handoutfor the class definitionand wrapper implementationof 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(), push(), pop() and top(). Single line functions may be defined within the class if you like. Multi-line functions should be defined outside of the class 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

What type of error checking should member functions push(), pop() and top() include if the code were to be used in real application?

Need help and tip please, Thanks!

Problem 1 See the stack_handoutfor the class definitionand wrapper implementationof a stack

stack_handout 09/08/17 09:13:34 stack.h: wrapper implemention based on single-linked list class stack_usage2.cpp: check for matching , brackets ** ADVANCED tinclude "stack.h" idefine QUOTE 34 #ifndef STACK-H define STACK_H include "slinked-list.h" class stack int main(int argc, char argv) const char *left = "({"; const char *right = "))"; public: bool empty) const f return v.empty )h int size const return v.size) stack bracket string text; void push (const data t &din)v.push front (din) void popo v pop front const data t & topreturn v.front while (getline (cin, text) for (const char // skip double quoted text if (*p-QUOTE) { *p= text . c-str ( ); *p; p++) { private: while ( ++p!OUOTE) h continue; list v endif for i> value) v.push (value) cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!