Created
June 15, 2019 21:05
-
-
Save mondoo/ab41b9f9a19c9ad2670655565a45f74d 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> | |
| template<typename T> | |
| struct Vector { | |
| T x; | |
| T y; | |
| public: | |
| Vector(T inX, T inY) | |
| { | |
| x = inX; | |
| y = inY; | |
| } | |
| }; | |
| int main() | |
| { | |
| Vector<int> xy = Vector<int>(10, 10); | |
| for (int x = 0, y = 0; | |
| x < xy.x && y < xy.y; | |
| x++, x >= xy.x ? (x = 0, y++) : 0) | |
| { | |
| std::cout << "x: " << x << " y: " << y << std::endl; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment