#include #include #include enum cellType {black,white}; void recursive (int x,int y,apmatrix &table); void main (void) { apmatrix table(20,20,white); ifstream infile ("digital.txt",ios::in); int n = 0; infile >> n; for (int g = 0;g < n;g++) { int y,z; infile >> y;infile >> z; table[y][z] = black; } int x=0,y=0; do { cout << " "; for (int g = 1;g < 10;g++) cout << g; for (g = 0;g < 10;g++) cout << g; cout << "0\n\n"; for (int a = 0;a < 20;a++) { if (a < 9) cout << a + 1; else if (a < 19) cout << a - 9; else cout << "0"; cout << " "; for (int b = 0;b < 20;b++) if (table[b][a] == black) cout << "*"; else cout << " "; cout << "\n"; } cout << "\n\nWhich object to erase? (Enter 2 points, or 21 21 to quit) --> "; cin >> x;cin >> y; x--;y--; if (x < 20 && table[x][y] == black) recursive(x,y,table); } while (x < 20); } void recursive (int x,int y,apmatrix &table) { table[x][y] = white; if (x + 1 < 20 && table[x+1][y] == black) recursive(x+1,y,table); if (x - 1 >= 0 && table[x-1][y] == black) recursive(x-1,y,table); if (y + 1 < 20 && table[x][y+1] == black) recursive(x,y+1,table); if (y - 1 >= 0 && table[x][y-1] == black) recursive(x,y-1,table); }