Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void add(Gang **&ptr, int &size, int where = -1) {
- Gang **sup_ptr = new Gang *[size + 1];
- for (int i = 0; i < size + 1; i++) {
- //sup_ptr[i] = new Gang; tu blad
- if (i == where) {
- sup_ptr[i] = new Gang(); tak chyba powino byc
- sup_ptr[i]->init();
- }
- else if (i > where && where >= 0) {
- sup_ptr[i] = ptr[i - 1];
- }
- else if (i == size && where < 0) {
- sup_ptr[i]->init();
- }
- else {
- sup_ptr[i] = ptr[i];
- }
- }
- delete[] ptr;
- ptr = sup_ptr;
- ++size;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement