Question: What about the second question of the same problem. Create a program that uses a derived class based on the list class you've created in

What about the second question of the same problem.

Create a program that uses a derived class based on the list class you've created in the first program. This program will use a stack data type.

class node {

void *info;

node *next;

public:

node (void *v) {info = v; next = 0; }

void put_next (node *n) {next = n;}

node *get_next ( ) {return next;}

void *get_info ( ) {return info;}

};

class list {

node *head;

int node_num; public:

public:

list ( ) { node_num = 0; head = 0;}

void remove (int);

void insert (void *, int);

void append (void * v)

void *find (int);

void display ( );

};

Write functions to push and pop the stack. Write a driver main program which gives 5 values (5 nodes created) that will push, pop and display data stored.

Output: While displaying the data, make sure you use an informational label - using the terms "Push", "Pop" or any other term which displays the action. All data that is displayed must be displayed in a way in which the mentor can easily read and understand

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 Programming Questions!