Last active
August 27, 2015 07:10
-
-
Save games/1bf64d07d7c19082cf92 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
| // { 1 2 3 4 } | |
| // { 5 6 7 8 } | |
| // { 9 10 11 12 } | |
| // {13 14 15 16 } | |
| // | |
| // 4 | |
| // 3 8 | |
| // 2 7 12 | |
| // 1 6 11 16 | |
| // 5 10 15 | |
| // 9 14 | |
| // 13 | |
| // | |
| int main() { | |
| int arr[4][4] = { | |
| { 1, 2, 3, 4}, | |
| { 5, 6, 7, 8}, | |
| { 9, 10, 11, 12}, | |
| {13, 14, 15, 16} | |
| }; | |
| for (int i = 3; i >= -3; --i) { | |
| for (int j = 0; j <= 3; ++j) { | |
| int y = i + j; | |
| if (y >= 0 && y <= 3) { | |
| std::cout << arr[j][y] << " "; | |
| } | |
| } | |
| std::cout << std::endl; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment