N x N matrix

I am trying to figure a way out to take in an input from a user and create a N x N matrix with what the user has inputed
int **arr, rows, i, j;
cout << "What is your n value? ";
cin >> rows;
arr = new int*[rows];
for (i = 0; i <= rows; i++) //This is for the rows
for(j = 0; j <= rows; j++)// This is for the columns which is
//same as rows.
cin >> arr[i][j];
cout << arr[i][j] << " ";
cout << endl;
}
This is what I have but I can't get the matrix to print out.
I was wondering if anyone knows what I'm doing wrong or have another way to print out a matrix from the input of a user.
Topic archived. No new replies allowed.