#include #include struct node { int data; node *next; }; class linklist { public: node *start; node *current; node *previos; node *temp; node *temp1; node *ptr; node *put_ptr; //public: linklist() { start=NULL; current=NULL; previos=NULL; temp = NULL; temp1=NULL; ptr=NULL; put_ptr=NULL; } /////////// THIS FUNCION IS STORING THE LINKED LIST IN ASCENDING ORDER void insert(int N) { current=start; temp = new node; temp -> data = N; temp -> next = NULL; if(start==NULL) { start = temp; } if(N < start->data) // to change order first change this sign { temp->next=start; start = temp; } else { while(current!=NULL && current->data <= N) // then change this sign { previos = current; current = current->next; } previos->next = temp; temp->next = current; } } //====================================================================== //////////////////// FUNCTION TO JUST CHECK VARIOUS VALUES OF POINTERS ETC void show(void) { cout<<"Starting node data: " <data<next<data);cout<next; while(ptr!=NULL) { textcolor(GREEN); cout<data<next; //copy the address of next node in start } temp1 = start; start=start->next; delete temp1; getch(); } }while(start!=NULL); } }; void main(void) { clrscr(); linklist r; r.insert(30); r.insert(40); r.insert(20); r.insert(60); r.showdata(); getch(); }