I am trying to assign a specific part of an array a new value, but it doesn't seem to be inserting the new value into the array.
char matrix[20][8] = {/*160 * '#'*/};
void Draw() {
system("CLS");
cout << "Welcome to Primitive Pong v1.0!" << endl;
for (int i = 0; i < 8; i++) {
cout << endl;
for (int j = 0; j < 20; j++) {
cout << matrix[i][j] << " ";
}
}
}
while (gameOver == false) {
matrix[10][4] = 'O';
Draw();
this_thread::sleep_for(chrono::milliseconds(1000));
}
I expect this to output a grid of 160 "#" with a "O" near the middle, but instead it just prints 160 "#". I am trying to make a game of console pong. I have tried using 'matrix[10][4] = {'O'};, but that does nothing different.