Question: Create a program that uses a derived class based on the list class youve created in the first program. This program will use a stack
Create a program that uses a derived class based on the list class youve 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:
list ( ) { node_num = 0; head = 0;}
void remove (int);
void insert (void *, int);
void append (void * v) {insert (v, node_num + 1); }
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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
