I am trying to figure out how to write a program in C++ that will use the stack data type. I cannot figure out how to write the functions that will push and pop the stack, as well as display the stack.
The program I write needs to include the following code into it. Can someone help me?
#include <iostream>
#include <stack>
using namespace std;
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 ( );
};
Aucun commentaire:
Enregistrer un commentaire