c++ - Can't insert symbols into my matrix -
i have matrix written out here, , appears on screen fine want put symbols it. can't seem symbols (x) appear in it. sorry first time working arrays.
#include <iostream> #define width 70 #define height 20 using namespace std; void main () { char world[height][width]; // draws matrix ( char = 0; < height; i++ ) { ( char j = 0; j < width; j++ ) { world[i][j] = '.'; cout << world[i][j]; } cout << endl; } // 1st symbol @ coordinates 1, 1 int x, y; x = 1, y = 1; world[x][y] = 'x'; cout << world[x][y]; // 2nd symbol @ coordinates 2, 2 x = 2, y = 2; world[x][y] = 'x'; cout << world[x][y]; //so on..
}
you have first insert x
s, , then print grid, not other way around.
Comments
Post a Comment