using namespace std;
class Lists{
public:
void insert_head(int insert);
void remove_head();
void insert_tail(int insert);
void print();
Lists();
private:
Node *head;
Node *tail;
};
struct Node{
int data;
Node *link;
};
int main()
{
Lists temp;
temp.print();
return 0;
system("PAUSE");
}
Lists::Lists(){
head = new Node;
head->Link=tail;
tail->Link=NULL;
}
void Lists::insert_head(int insert){
Node *temp;
temp->data=insert;
temp->link=head->link;
head->link=temp; //add new Node,
}
void Lists::insert_tail(int insert){
Node *temp;
temp->data=insert;
temp->link=NULL;
tail->link=temp;
}
void Lists::print(){
Node *current=head;
while(current->link==NULL){
cout << current->data << endl;
current=current->link;
}
}
void Lists::remove_head(){
Node *temp=head->link;
head->link=temp->link;
delete temp;
}