Spacing out 2d Array
Hello all. I am currently working on a project in which i use a 2d array to hold a representation of a map for the game snake. I draw the map in a file and then read it into the 2d array. I read it in fine, because i can cout it but then heres where my problem occurs. It just cout's it in a line, instead of how i had it written in the file. Is there anyway to make it so it looks exactly like whats in the file? Heres my code for reading it in and outputting it. Thanks for any help!
COL and ROW are const int's with the max size of the 2d array.
in >> array[row][col];
cout << array[row][col] << endl;
Better explanations of the problem are better.. And in the future, remember to post data declarations -- quite often that is the key to the problem.
Originally Posted by trev456
You might have to put the endl outside the inner for loop, if each row is on a separate line.
Ahh yes that would be it =) Thank you so much all and ill try to post my data declarations next time!