Problem

2/11

数组旋转

Problem

给你一个二维数组N*M(0 < N,M <= 20)。 数组元素的值是从键盘输入的。
显示数组,使第一行成为第一列,依此类推。
 
输入
第一行指定数组的大小。 N - 行数,M - 列数(0 < N,M <= 20)
后跟 N 行,每行有 M 个数字 - 二维数组的元素(每个元素的模数不超过 50)。
 
输出
显示数组,使第一行成为第一列,依此类推。
 
 
例子
<头> <正文>
 
# 输入 输出
1
2 3
1 2 3
4 5 6
1 4
2 5
3 6
Write the program below
#include <iostream>
using namespace std;

int main() {
   
   int n,m;
   int a[20][20];
   cin>>n>>m;
 
    for(int i =0;i<n;i++)
     for(int j =0;j<m;j++)
        cin>>a[i][j];   

     

Program check result

To check the solution of the problem, you need to register or log in!