#include<iostream.h>

struct node{ int info;

                   node*next;};

void main(){

      node*list;

      int x;

      cout<<"INITIALIZE THE LIST:"<<endl;

      list=NULL;

      cout<<"INTSERTING NODE B AT BEGINNING OF THE LIST"<<endl;

      node*b;

      b=new node;

      cout<<"ENTER THE ITEM:";

      cin>>x;

      b->info=x;

      b->next=list;

      list=b;

      cout<<"ITEM INSERTED:"<<list->info<<endl;

      cout<<"INERTING THE NODE E AFTER THE NODE B"<<endl;

      node*e;

      e=new node;

      cout<<"ENTER THE ITEM:";

      cin>>x;

      e->info=x;

      e->next=NULL;

      b->next=e;

      cout<<"INSERTED ITEMS IN LIST ARE:"<<list->info<<""<<list->next->info<<endl;

      cout<<"INSERTING THE NODE M BETWEEN B AND E"<<endl;

      node*m;

      m=new node;

      cout<<"ENTER THE ITEM:";

      cin>>x;

      m->info=x;

      m->next=e;

      b->next=m;

      cout<<"INSERTED ITEMS IN LIST ARE:";

      cout<<list->info<<""<<list->next->info<<""<<list->next->info<<endl;

      cout<<"REMOVE THE MIDDLE NODE FROM LIST B, M, AND E"<<endl;

      b->next=e;

      m->next=NULL;

      delete m;

      cout<<list->info<<""<<list->next->info<<endl;

      cout<<"REMOVE THE END NODE FROM LIST B E"<<endl;

      b->next=NULL;

      delete e;

      cout<<list->info<<endl;

      cout<<"REMOVE THE FIRST ELEMENT FROM LIST B"<<endl;

      b=list;

      list=list->next;

      b->next=NULL;

      delete b;

}//MAIN

1