Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void DinamycList::Add(Equipment _path)
- {
- list[position] = _path;
- position++;
- if (position == size)
- {
- Equipment *temp = new Equipment[size];
- for (int i = 0; i < position; i++)
- temp[i] = list[i];
- delete[] list;
- size *= 1.5;
- list = new Equipment[size];
- for (int i = 0; i < position; i++)
- list[i] = temp[i];
- }
- }
- void DinamycList::Erase(int _id)
- {
- for (int i = _id; i < position; i++)
- list[i] = list[i + 1];
- position--;
- if (size / 1.5 >= position)
- {
- size /= 1.5;
- Equipment *temp = new Equipment[size];
- for (int i = 0; i < position; i++)
- temp[i] = list[i];
- delete[] list;
- list = new Equipment[size];
- for (int i = 0; i < position; i++)
- list[i] = temp[i];
- delete[] temp;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement