Question: Implement a 'stack' class with a linked list. C++ //-------------------------------------------------------------------------------------------- class stack { private: class node { public: double data; node *next; node() { data

Implement a 'stack' class with a linked list. C++ //-------------------------------------------------------------------------------------------- class stack { private: class node { public: double data; node *next; node() { data = x; next = NULL; } }; public: stack() { head = NULL; tail = NULL; } ~stack() //desconstructor, called automatically when object goes out of scope { popAll(); } void push(double x) { //insert code here } //push x onto the top of the stack double pop() { //insert code here } // remove and return top item from stack bool empty() { //insert code here } // is stack empty void popAll { //insert code here } //remove all items from the stack };

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To compl... View full answer

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!