矩阵转置
矩阵转置
http://www.nowcoder.com/questionTerminal/351b3d03e410496ab5a407b7ca3fd841
#include<iostream> using namespace std; int main(){ int n,m; cin>>n>>m; int a[n+1][m+1]; for(int i=0;i<n;i++) for(int j=0;j<m;j++)cin>>a[i][j]; int b[m+1][n+1]; for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ b[i][j]=a[j][i];//转置 cout<<b[i][j]<<" "; } cout<<endl; } }