OK I got it to rotate but there is one problem for example it does this:

123

456

789

this is not the 2 dimensional array i'm working with keep that in mind... I'm just using it for an example... this is supposed to work with any matrix no matter the size. I'm using random number gen to produce the numbers this is just an example... but this is what it does it rotates all the numbers but when it gets to the left corner it does this...

412

953

876

well here is the code

Code:void Array2::rotate() { int temp1, temp2; int a=n-1; for (int r=0; r<n/2; r++) // for rows { temp1=A[r][r]; for(int c=r; c<n-1; c++) // across the top { temp2=temp1; // first number = temp2 temp1=A[r][c]; // temp1 = second A[r][c]= temp2; // A[r][c] becomes becomes whats in temp2 } for(int h=r; h<n-1; h++) // down right side { temp2=temp1; // first number = temp2 temp1=A[h][a]; // temp1 = second A[h][a]= temp2; // A[r][c] becomes becomes whats in temp2 } for(int i=a; i>=0; i--) { temp2=temp1; // first number = temp2 temp1=A[a][i]; // temp1 = second A[a][i]= temp2; // A[r][c] becomes becomes whats in temp2 } for(int j=n-1; j>=0; j--) { temp2=temp1; // first number = temp2 temp1=A[j][r]; // temp1 = second A[j][r]= temp2; // A[r][c] becomes becomes whats in temp2 } a++; } }