Dec 3, 2015 at 9:10pm UTC
Hi there guys,
This is my first post. I am new to C++ and would like to print out a 'maze' of characters. Please could you help me with fixing my code?
I don't really know why it wont print when i cout. Thank you very much
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main() {
const int mazeheight = 12;
const int mazewidth = 12;
char maze[mazeheight][mazewidth] =
{
{"#","#","#","#","#","#","#","#","#","#","#","#"},
{"#",".",".",".","#",".",".",".",".",".",".","#"},
{".",".","#",".","#",".","#","#","#","#",".","#"},
{"#","#","#",".","#",".",".",".",".","#","#","#"},
{"#",".",".",".",".","#","#","#",".","#",".","."},
{"#","#","#","#",".","#",".","#",".","#",".","#"},
{"#",".",".","#",".","#",".","#",".","#",".","#"},
{"#","#",".","#",".","#",".","#",".","#",".","#"},
{"#",".",".",".",".",".",".",".",".","#",".","#"},
{"#","#","#","#","#","#",".","#","#","#",".","#"},
{".",".",".",".",".",".",".","#",".",".",".","#"},
{"#","#","#","#","#","#","#","#","#","#","#","#"},
};
std::stringstream s;
s << maze;
for (int i = 0; i < mazeheight; i++) {
for (int j = 0; j < mazewidth; j++) {
maze[i][j];
cout << maze[i][j];
}
}
system("pause");
return 0;
}