2

I have a std::array with several items and I want to compare it from a certain position and also insert in a certain position, for example.

std::array<int, 10> numbers {{ 9, 5, 6, 4, 5, 6, 1, 10, 15, 25 }};

I want to compare the array numbers from item 5 until the last one, with this one, from the beginning, that is position 0 until position 4.

std::array<int, 10> compare {{ 6, 1, 10, 15, 25, 0, 0, 0, 0, 0 }};

It will (in this case) return true.

And how to insert items from a position? I want to insert on the array compare from the position 5 until the last position, that is 9.

For example, if I want to insert these numbers: 5, 45, 32, 14, 10. It will turn:

std::array<int, 10> compare {{ 6, 1, 10, 15, 25, 5, 45, 32, 14, 10 }};

Thanks in advance.

4

0 回答 0