I
I
Ilya2018-02-09 17:25:12
C++ / C#
Ilya, 2018-02-09 17:25:12

How to remove array elements with given conditions in C++?

Hello. I looked in the questions here for my solution, and did not find it. So here it is:
- Compress the array by removing all elements from it, the modulus of which does not exceed 1. Fill the freed elements at the end of the array with zeros.
The dimensions of the arrays are entered at runtime and then memory is allocated for the elements of the arrays. Do not use an additional array.
PS if you know where this is sorted out as an example, it would be more useful =)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
longclaps, 2018-02-09
@chelovek_iz_ekb

two pointers

V
vasiliev, 2018-02-09
@vasiliev

std::remove_if

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question