Swapping sections of an array with each other in C++ -
Is there an easy way to swap the squares (sections) of arrays with each other? That is, I have an array:
array [0] = 1; Array [1] = 2; Array [2] = 3; Array [3] = 4; Array [4] = 5; Array [5] = 6; Array [6] = 7; Array [7] = 8; A function called and swapSections (startX, endX, startY, endY) that these values are given too much, limit the values set by endX Swaps - startX with values from x range to start to endY , so from my example ... < P> If x range = 2 and startX = 0 and y category = 3 and startY = 5 , it The array [0] and the array will give the space [1] where the array [5] and the array [6] are, and then the array [6] holds after the array [7] All of which are pushed down one by the other, I'm not sure how to go about this, and I was physically copying memory into a temporary array, but I think there is a better way of doing this is. (BTW will be the last result from my example): array [0] = 6; Array [1] = 7; Array [2] = 8; Array [3] = 3; Array [4] = 4; Array [5] = 5; Array [6] = 1; Array [7] = 2;
You want to see it and it's slice.
Comments
Post a Comment