0
The Wall
What code is needed to output a right wall (for example the right wall of a map).
2 ответов
+ 1
This is a possible method. This uses an array of 512 characters as the map.
char map[32 * 32];
//make the whole character array blank
for(int count = 0; count < 512; ++count)
map[count] = ' ';
//make the wall on the right side
for(int count = 0; count < 32; ++count)
map[count * 32 + 30] = '|';
//end each line with a newline character
for(int count = 0; count <32; ++count)
map[count * 32 + 31] = '\n';
//printing the map
for(int count = 0; count < 512; ++count)
std::cout << map[count];
0
Ok just a minor error in my first post! 32 times 32 is 1024, not 512! Those 512's in the for loops should be 1024!