Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char* argv[])
- {
- char arr[3][3] = {{42, 0, '*'},{'*', 0, 3},{'*', 0, 0}};
- int count = 0;
- int i = 0, j = 0;
- int di[] = {-1,-1,-1,0,1,1,1,0};
- int dj[] = {-1,0,1,1,1,0,-1,-1};
- for (int k = 0; k < 8; ++k)
- {
- if (arr[i + di[k]][j + dj[k]] == '*') ++count;
- }
- cout << count << '\n';
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement