Advertisement
czlowiekzgon

Untitled

Nov 7th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. void remove(Assassin **&ptr, int &size,int where) {
  2. Assassin **sup_ptr = new Assassin *[size - 1];
  3.  
  4. for (int i = 0; i < size;i++) {
  5. if (i == where) {
  6. delete[] ptr[i];
  7. }
  8. else if(i < where){
  9. sup_ptr[i] = new Assassin;
  10. sup_ptr[i] = ptr[i];
  11.  
  12. }
  13. else {
  14. sup_ptr[i - 1] = new Assassin;
  15. sup_ptr[i - 1] = ptr[i + 1];
  16.  
  17. }
  18. }
  19.  
  20.  
  21. delete[] ptr;
  22. ptr = sup_ptr;
  23. --size;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement