Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:27
Show Gist options
  • Save pinglunliao/55f084951d6d168485fa to your computer and use it in GitHub Desktop.
Save pinglunliao/55f084951d6d168485fa to your computer and use it in GitHub Desktop.
#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