brahs need help with rotatting array (srs)

So my task is to rotate array by 90 degrees.
but my problem is that when i try to do i get wrong
results it's shiffted randomly or something :/ (+i got some weard error in output too..)


i think i've got wrong idea how to shift it properly... can somebody please
explain ? Thank you.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <ctime>


using namespace std;

int main()
{
    time_t t;
    srand((unsigned) time(&t));
    
    
    const int N=3,M=3;
    double arr[N][M];
    for(int i=0; i<N; i++)
    
        for(int j=0; j<M; j++)
        arr[i][j] = rand()% 90 + 9 ;
                
                
    for(int i=0; i<N; i++)
    {
        for(int j=0; j<M; j++)
        cout << arr[i][j] << " " << " ";
        cout << endl;        
    }
    
     cout << endl << endl;
    
    for(int i=0; i<N; i++)
    {
        for(int j=0-1; j<M; j++)
        cout << arr[i][j] << " " << " ";
        cout << endl;        
    }
 
  
    
system("pause");
return 0;
}


Topic archived. No new replies allowed.