Skip to content

Instantly share code, notes, and snippets.

@jwvg0425
Created April 15, 2016 07:40
Show Gist options
  • Save jwvg0425/7b8e24ca778019bbc478715aa6bed14d to your computer and use it in GitHub Desktop.
Save jwvg0425/7b8e24ca778019bbc478715aa6bed14d to your computer and use it in GitHub Desktop.
4dir
#include <iostream>
using namespace std;
int main()
{
for(int i =0; i < 4; i++)
{
int x = (i - 1) * (i % 2 - 1);
int y = (i - 2) * (i % 2);
cout << "(" << x << "," << y << ")" << endl;
}
return 0;
}
/* output
(1,0)
(0,-1)
(-1,0)
(0,1)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment