1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#define _CRT_SECURE_NO_WARNINGS
#define INF 187654321
 
 
#include<iostream>
 
using namespace std;
 
int arr[2][2= { {12}, {34} };
int temp[2][2];
 
int main() {
 
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            cout << arr[i][j] << " ";
        }
        cout << endl;
    }
 
    cout << endl;
 
 
    // 배열 90도 회전
    for (int i = 0; i < 2; i++)
        for (int j = 0; j < 2; j++)
            temp[i][j] = arr[2 - j - 1][i];
 
 
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            cout << temp[i][j] << " ";
        }
        cout << endl;
    }
 
    cout << endl;
 
    return 0;
}
 
cs

 

 

반응형

+ Recent posts