#include <iostream>
usingnamespace 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 ( );
};
class stack
{
list stacklist;
node *head;
public:
stack() // constructor
{
head=NULL;
}
void push(); // to insert an element
void pop(); // to delete an element
void show(); // to show the stack
};
void append()
{
node *ptr;
int value;
cout<<"\nPUSH Function\n";
cout<<"Enter a number to insert: ";
cin>>value;
if(head!=NULL)
ptr->next;
head=ptr;
cout<<"\nNumber has been inserted into the stack.";
}
When I compile I get the following errors:
In function 'void append()':
48:8: error: 'head' was not declared in this scope
6:11: error: 'node* node::next' is private
49:14: error: within this context
49:18: warning: statement has no effect [-Wunused-value]
50:5: error: 'head' was not declared in this scope
Can someone point (pun intended) me in the right direction?