How to move negative elements of marix’s back diagonal forward

  c++

I have a rectangle-shaped matrix:

int arr[3][4] = {1,2,-3,4,
                 5,-6,7,8,
                 9,1,2,3};

And I need to move negtive items forward along the back diagonal

         1, 2, -, 4,
         5, - ,7 ,8,
Diagonal:-, 1, 2, 3 

like this:

int arr[3][4] =  {1,2,9,4,
                 5,-3,7,8,
                 -6,1,2,3};

Is it possible to do this? I even dont know what to start from.

Will be thankful for any answer

Source: Windows Questions C++

LEAVE A COMMENT