C++ Chk in all 8 directions of King || Shorter and Clean Code
\nclass Solution {\npublic:\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king){\n        \n        vector<vector<int>>
```\nclass Solution {\npublic:\n    vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king){\n        \n        vector<vector<int>>ans;\n        //up down left right drup drdn dlup dldn\n        vector<int>dx = {-1,1,0,0,-1,1,-1,1};\n        vector<int>dy = {0,0,-1,1,1,1,-1,-1};\n        \n        vector<vector<int>>board(8,vector<int>(8,0));\n        for(int i = 0; i<queens.size(); i++){\n            board[queens[i][0]][queens[i][1]] = 1;    \n        }\n        \n        for(int i = 0; i<8; i++){\n            \n            int kr = king[0];\n            int kc = king[1];\n            \n            while(kr<8 and kr>=0 and kc<8 and kc>=0){\n                if(board[kr][kc] == 1){\n                    ans.push_back({kr,kc});\n                    break;\n                }\n                kr+=dx[i];\n                kc+=dy[i];\n            }\n        }\n        \n        return ans;\n    }\n};\n```
['C', 'C++']