c++将矩阵顺时针旋转90度539 11 14 75 2356 81 22 91 4360 12 36 33 8757 68 16 85 813 51 51 36 10#include #include #include #include using namespace std;int N,num[6][6];int main(){freopen("matrix.in","r",stdin);freopen("matrix.out","w",stdout);c
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/15 00:32:14
![c++将矩阵顺时针旋转90度539 11 14 75 2356 81 22 91 4360 12 36 33 8757 68 16 85 813 51 51 36 10#include #include #include #include using namespace std;int N,num[6][6];int main(){freopen(](/uploads/image/z/8330339-11-9.jpg?t=c%2B%2B%E5%B0%86%E7%9F%A9%E9%98%B5%E9%A1%BA%E6%97%B6%E9%92%88%E6%97%8B%E8%BD%AC90%E5%BA%A6539+11+14+75+2356+81+22+91+4360+12+36+33+8757+68+16+85+813+51+51+36+10%23include+%23include+%23include+%23include+using+namespace+std%3Bint+N%2Cnum%5B6%5D%5B6%5D%3Bint+main%28%29%7Bfreopen%28%22matrix.in%22%2C%22r%22%2Cstdin%29%3Bfreopen%28%22matrix.out%22%2C%22w%22%2Cstdout%29%3Bc)
c++将矩阵顺时针旋转90度539 11 14 75 2356 81 22 91 4360 12 36 33 8757 68 16 85 813 51 51 36 10#include #include #include #include using namespace std;int N,num[6][6];int main(){freopen("matrix.in","r",stdin);freopen("matrix.out","w",stdout);c
c++将矩阵顺时针旋转90度
5
39 11 14 75 23
56 81 22 91 43
60 12 36 33 87
57 68 16 85 8
13 51 51 36 10
#include
#include
#include
#include
using namespace std;
int N,num[6][6];
int main(){
freopen("matrix.in","r",stdin);
freopen("matrix.out","w",stdout);
cin>>N;
for(int i=0;inum[i][j];
for(int i=0;i
c++将矩阵顺时针旋转90度539 11 14 75 2356 81 22 91 4360 12 36 33 8757 68 16 85 813 51 51 36 10#include #include #include #include using namespace std;int N,num[6][6];int main(){freopen("matrix.in","r",stdin);freopen("matrix.out","w",stdout);c
楼主你好!
这个是矩阵转置问题,根据转置的定义如下:
矩阵A的转置为这样一个n×m阶矩阵B,满足B=a(j,i),即 b (i,j)=a (j,i)(B的第i行第j列元素是A的第j行第i列元素)
所以根据定义更改部分如下:(将原来的i改为j,原来的j改为i,num[i][N-1]改为num[N-1][j]即可,具体参照如下代码)
for(int i=0;i