0

The Wall

What code is needed to output a right wall (for example the right wall of a map).

2nd Feb 2017, 11:55 PM
Emanuel Dajti
Emanuel Dajti - avatar
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];
3rd Feb 2017, 12:26 AM
R- Ry
R- Ry - avatar
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!
3rd Feb 2017, 3:42 AM
R- Ry
R- Ry - avatar