SHARE
TWEET

Untitled

a guest Jan 22nd, 2020 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main(int argc, char* argv[])
  2. {
  3.     char arr[3][3] = {{42, 0, '*'},{'*', 0, 3},{'*', 0, 0}};
  4.     int count = 0;
  5.     int i = 0, j = 0;
  6.     int di[] = {-1,-1,-1,0,1,1,1,0};
  7.     int dj[] = {-1,0,1,1,1,0,-1,-1};
  8.  
  9.     for (int k = 0; k < 8; ++k)
  10.     {
  11.         if (arr[i + di[k]][j + dj[k]] == '*') ++count;
  12.     }
  13.    
  14.    
  15.  
  16.     cout << count << '\n';
  17.     system("pause");
  18.     return 0;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top