Question: Write a C++ class (or a set of classes) that implements a stack using a linked list. The type of data contained in the stack

Write a C++ class (or a set of classes) that implements a stack using a linked list. The type of data contained in the stack should be double. The maximum size of the stack is 30. Implement at least the following methods:

.

Constructor and destructor; // 5 pts void push (double value); // pushes an element with the value into the stack. 5 pts.

double pop (); // pops an element from the stack and returns its value. 5 pts.

int isEmpty(); // returns 1 if the stack is empty, 0 otherwise. 5 pts.

int numOfElements(); // returns the number of elements in the stack. 5 pts.

void printElements(); // print out the current stack to the console. 5 pts.

A main function; // execute each method of your stack (except the destructor) at least once without asking input from the users.

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!