Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- bool esValido(int i, int j, int alto, int ancho)
- {
- return (0 <= i && i < alto && 0 <= j && j < ancho);
- }
- int x[] = {-1, 0, 1, -1, 1, -1, 0, 1};
- int y[] = {1, 1, 1, 0, 0, -1, -1, -1};
- void recorrerMatrizYCheckearAdyacentes(vector<vector <char> > m)
- {
- for(int i=0; i<m.size(); i++)
- {
- for(int j=0; j<m[i].size(); j++)
- {
- int contadorAst = 0;
- for(int k=0; k<8; k++)
- {
- int dx = i+x[k];
- int dy = j+y[k];
- if(esValido(dx, dy, m.size(), m[i].size()))
- {
- ///Hago algo en la posición dx, dy
- }
- }
- }
- }
- }
- int main()
- {
- cout << "Hello world!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment