Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. int array[10][10];
  2. int neighbour[3] = {-1, 0, 1};
  3.  
  4. for(int x = 0; x < 10; ++x)
  5. {
  6. for(int y = 0; y < 10; ++y)
  7. {
  8. for(int i = 0; i < 3; ++i)
  9. {
  10. for(int j = 0; j < 3; ++j)
  11. {
  12. if(x + neighbour[i] > 0 && x + neighbour[i] < 10 && y + neighbour[j] > 0 && y + neighbour[j] < 10)
  13. doSomething(x+neighbour[i], y+neighbour[j]);
  14. }
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement