改变一下输出顺序就行了。
#include
using namespace std;
int matrix[205][205] = {0};
int main()
{
int m, n;
cin >> m >> n;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
cin >> matrix[i][j];
}
}
for (int i = 0; i < n; i++)
{
int j = m-1;
for ( ; j > 0; j--)
{
cout << matrix[j][i] << " ";
}
cout << matrix[j][i] << endl;
}
return 0;
}