a015.
矩陣的翻轉
| From: [118.168.199.143] |
發表日期
:
2014-03-07 02:32
#include <stdio.h>
void getInput(int x, int y, int array[100][100])
{
int i, j;
for (i = 0; i < x; i++)
for (j = 0; j < y; j++)
scanf("%d", &array[i][j]);
}
void output(int x, int y, int array[100][100])
{
int i, j;
for (i = 0; i < x; i++)
{
for (j = 0; j < y; j++)
printf("%d ", array[j][i]);
printf("\n");
}
}
int main()
{
int x = 0;
int y = 0;
int array[100][100] = {0};
while (scanf("%d %d", &x, &y) != EOF)
{
getInput(x, y, array);
output(y, x, array);
}
}