Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int array[10][10];
- int neighbour[3] = {-1, 0, 1};
- for(int x = 0; x < 10; ++x)
- {
- for(int y = 0; y < 10; ++y)
- {
- for(int i = 0; i < 3; ++i)
- {
- for(int j = 0; j < 3; ++j)
- {
- if(x + neighbour[i] > 0 && x + neighbour[i] < 10 && y + neighbour[j] > 0 && y + neighbour[j] < 10)
- doSomething(x+neighbour[i], y+neighbour[j]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement