Hey guys i'm having a problem with my formatting of 2d array output. I'm building this for a .pgm image--say the code is
where numrows is 3 and numcols is 5..so the ouput would beCode:for(int row = 0; row < numrows; row++) for(int col = 0; col < numcols; col++) bwarray[row][col] = 255; for(int r2 = 0; r2 < numrows; r2++) for(int c2 = 0; c2 < numcols; c2++) cout << bwarray[r2][c2] << ' ';
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
I need the output to be
255 255 255 255 255
255 255 255 255 255
255 255 255 255 255
I've tried working with modulus with no luck (i've never been good with loops)..anyone have any ideas? Any help is appreciated.