Here is My code, it\'s finding the Transpose of a Matrix, but columns and rows are the same as the input 10*5.
If entered:
1 2 3 4 5 6 7 8 9 10
11
You have 5 rows and 10 columns of input, so
int r = 10;
int c = 5;
should be
int r = 5;
int c = 10;
Also to match the output to the desired output,
cout << " " << trans[i][j];
if(j == r - 1)
cout << endl;
should be
cout << trans[i][j];
if (trans[i][j] < 10) cout << " ";
if(j == r - 1)
cout << endl;
else
cout << " ";
because