Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. bool funkcja(Element *glowa, int nr)
  2. {
  3. Element *act = glowa;
  4. int max = INT_MIN;
  5. while (act -> next != NULL)
  6. {
  7. if(act -> dane > max) max = act -> dane;
  8. act = act -> next;
  9. }
  10. act -> next = new Element;
  11. act -> next -> dane = max;
  12. act -> next -> next = NULL;
  13. act = glowa;
  14. for(int i=0; i<nr-1 && act->next != NULL ; i++)
  15. {
  16. act = act->next;
  17. }
  18. if (act->next != NULL)
  19. {
  20. Element *pom = act -> next;
  21. act -> next = act -> next -> next;
  22. delete pom;
  23. return 1;
  24. }
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement