血的教训
请注意,最后的输出代码中的第二重循环应该是j<=m
for(int i=1;i<=n;i++){ for(int j=1;j<= m ;j++){ cout<<a[i][j]<<" "; } cout<<endl; }
而不是j<=n
for(int i=1;i<=n;i++){ for(int j=1;j<= n ;j++){ cout<<a[i][j]<<" "; } cout<<endl; }
虽然这个问题很弱智,但这个问题很致命,也有很多血的教训