#include using namespace std; struct Elem{ int liczba; Elem*next; }; bool funkcja (Elem*&glowa, int numer) { if (glowa==NULL){ return false; } int max = glowa->liczba; Elem*akt=glowa; while(akt!=NULL) { if(akt->liczba>max){ max=akt->liczba; } akt=akt->next; } Elem*ost=glowa; while(ost->next!=NULL) { ost=ost->next; } Elem*nowy=new Elem; nowy->liczba=max; nowy->next=NULL; ost->next=nowy; akt=glowa; int n=0; while(akt!=NULL) { n++; akt=akt->next; } if ((numer<=0) ||(numer>n)){ return false; } if (numer==1){ Elem*u=glowa; glowa=glowa->next; delete u; }else{ Elem*pu=glowa; for(int i=1; inext; } Elem*uu=pu->next; pu->next=uu->next; delete uu; } return true; } Elem* stworz () { Elem* glowa = new Elem; Elem* tmp = glowa; do { cin >> glowa -> liczba; cout << " "; tmp -> next = new Elem; tmp = tmp -> next; tmp -> next = NULL; } while (tmp->liczba!=0); return tmp; } int main() { Elem *glowa = NULL; stworz(); funkcja(glowa,4); return 0; }