fork download
  1. #include <bits/stdc++.h>
  2. using pii = std::pair<int,int>;
  3. const pii steps[] = {{-1,0},{1,0},{0,-1},{0,1}};
  4. int main() {
  5. int x = 2,y=2;
  6. for (auto [dx,dy] : steps) {
  7. int newX = x + dx;
  8. int newY = y + dy;
  9. std::cout << newX << ' ' << newY << '\n';
  10. }
  11. }
  12.  
Success #stdin #stdout 0s 4292KB
stdin
Standard input is empty
stdout
1 2
3 2
2 1
2 3