Hi, I Am Making Program That Take Input From User For Matrix And Transpose Them
But Its not Showing Output Of Transpose Please Check The Code And Describe It In A beginner Level I Don`t Know Much About C\C++
If you work with a 1d structure instead of 2, and copy into a new destination, it is really simple.
for(k = 0; k < rows; k++)
{
for(j = 0; j < cols; j++)
result[j*rows + k] = orig[k*cols +j];
}
or the same thing in 2-d
for(k = 0; k < rows; k++)
{
for(j = 0; j < cols; j++)
result[j][k] = orig[k][j];
}
don't forget that result is [cols][rows] in terms of dimensions if not the same.