// In this program we are deleting only the first node of linked list #include #include struct node { int data; node *next; }; class linklist { private: node *start; node *current; node *temp; node *ptr; node *temp1; public: linklist() { start=NULL; current=NULL; temp = NULL; temp1=NULL; } void insertnode(int N) { temp = new node; temp -> data = N; temp -> next = NULL; if(start==NULL) { start = temp; } if(current != NULL) { while(current->next!=NULL) { current=current->next; } current->next=temp; current=current->next; current->next=NULL; } if(current==NULL) {current=temp;} } void deletestart(void) { if(start==NULL) { cout<<"Can't delete any more data.... linked list empty !! "<next; delete temp1; } } void LRead(void) { ptr=start; while(ptr!=NULL) { cout<data<next; //copy the address of next node in start } } }; void main(void) { clrscr(); linklist r; r.insertnode(10); r.insertnode(20); r.deletestart(); r.insertnode(30); r.deletestart(); r.insertnode(90); r.deletestart(); r.LRead(); getch(); }