Hi, i'm sorry for bothering you, i wanted to arrange numbers (ascending), i tought everything is ok, but... where's the problem? Thanks... Code: void sort(){ elementi *temp = first, *next, *t1, *t2; for(next = temp->next; next !=NULL; next = temp->next){ next=temp->next; if(temp->value > next->value) { if(next!=last){ t1=temp; t2=next; t1->next=next->next; temp=t2; next=t1;} else { t1=temp; t1->next=NULL; t1=last; temp=temp->next; temp->next=t1; }} else { temp = temp->next; }} };

You're supposed to tell us what you expect to happen and how that's failing to happen. You are also supposed to tell us what things like "elementi" are. You're looking at your code and can't figure it out, but you want us to do it with guesses. Nuh uh.

My CODE looks like that, but, for example i enter values 1, 5, 4, 10 -> i suppose to see out -> 1, 4, 5 10, but i see just -> 1, 5, 10 Code: class klase { struct elementi { int value; //value of node elementi *next; }; elementi *current, *last, *first; public : klase(){last = current = first = NULL;} ~klase() { izdzest(); }; void sort(){ elementi *temp = first, *next, *t1, *t2; for(next = temp->next; next !=NULL; next = temp->next){ next=temp->next; if(temp->value > next->value) { if(next!=last){ t1=temp; t2=next; t1->next=next->next; temp=t2; next=t1;} else { t1=temp; t1->next=NULL; t1=last; temp=temp->next; temp->next=t1; }} else { temp = temp->next; }} };