for (int i = 0; i < height ; i++) { for (int j = 0; j < width; j++) { if (j == 0) cout << "#"; //walls if (i == y && j == x) cout << "*"; // snake tale else if (i == fruitY && j == fruitX ) cout << "%"; // change it to change the fruit else { bool print = false; for (int k = 0; k< nTail ; k++) { if (tailX [k] == j && tailY [k] == i) { cout << "*"; print = true; } } if (!print) cout << " "; } if (j == width -1) cout << "#"; } cout << endl; } for (int i = 0; i< width+2; i++) cout << "#"; cout << endl;