Last active
November 5, 2019 08:27
-
-
Save pinglunliao/55f084951d6d168485fa to your computer and use it in GitHub Desktop.
a015: 矩陣的翻轉 FYI: https://yunlinsong.blogspot.com/2016/02/blog-post_2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
const int SIZE = 100; | |
int matrix[SIZE][SIZE]; | |
int row, col; | |
while(cin >> row >> col) | |
{ | |
for(int i = 0; i < row; i++) | |
{ | |
for(int j = 0; j < col; j++) | |
{ | |
cin >> matrix[i][j]; | |
} | |
} | |
for(int j = 0; j < col; j++) | |
{ | |
for(int i = 0; i < row - 1; i++) | |
{ | |
cout << matrix[i][j] << " "; | |
} | |
cout << matrix[row-1][j]; | |
cout << endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment