// In this program we are deleting only the last 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; node *previous; public: linklist() { start=NULL; current=NULL; temp = NULL; temp1=NULL; previous=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; previous=current; current=current->next; current->next=NULL; } if(current==NULL) {current=temp;} } void deletelast(void) { delete previous->next; current=previous; current->next=NULL; } void READ(void) { ptr=start; while(ptr!=NULL) { cout<data<next; //copy the address of next node in start } } void show(void) { cout<next<