#35850: 紀錄


chrisccc1224@gmail.com (aaaaaa)

學校 : 臺南市新東國中
編號 : 192981
來源 : [140.113.91.241]
最後登入時間 :
2023-10-16 10:59:41
a015. 矩陣的翻轉 | From: [124.218.214.55] | 發表日期 : 2023-06-19 11:33

#include<iostream>
#include<string>
using namespace std;
int main()
{
 
int row, column, i,j;
while (cin >> row >> column)//不能用while(cin) 這樣eof時會多輸出
{
 
int a[100][100];//題目有說<100
for (i = 0; i < row; i++)
{
for (j = 0; j < column; j++)
{
cin >> a[i][j];
}
}
int x, y;
for (x = 0; x < column; x++)
{
for (y = 0; y < row; y++)
{
cout << a[y][x] << " ";
}
 
cout << endl;
 
}
}
 
return 0;
}
 
 
 
ZeroJudge Forum