MAP (NEED HELP ASAP) please
I’m trying to keep track of the position of a character in a 2d array map. I want a visual representation of the position of a character , I think I’m close to figuring it out, but whenever I enter a movement command, my initial position should return to 1 but it doesn’t. Can anyone help me out with this? Thats what i have so far: #include <iostream> using namespace std; void printBoard(); const int ROW = 5; const int COL = 6; int board[ROW][COL]; int grid[6][5] ; int main() { char hero = 'h'; char direction; //int grid[6][5] = { {0} }; printBoard(); //grid[0][0] = hero; while (1) { // get pos of the hero cout << "Enter a direction" << endl; cin >> direction; //printBoard(); if (direction == 's') { grid[0][1] = hero; printBoard(); } if (direction == 'n') { grid[3][1] = hero; printBoard(); } if (direction == 'e') { grid[1][1] = hero; printBoard(); } } system("pause"); return 0; } void printBoard() { int x, y; for (x = 0; x < 6; x++) { for (y = 0; y < 5; y++) { cout << (grid[x][y] == 0); } cout << endl; } }