c++ - Creating a 3x3 box inside a looped grid -
I have a project for the school. I created a grid which looks like this: Use of the following loop: Pre> I want to receive it: <00p> My attempt code (I have known wrongly since) This does not work How to get it, I'm losing it on. Any help on this will be great Definitely use this code The tax grid is made initially: and not this: I just add this second loop (runs after the first time): 0000000000000000000000000000000000000000000000000000000000000000000000 0000000000 0000000000 0000000000
IIM [10] [10]; For (int i = 0; i & lt; 10; i ++) {for (int j = 0; j & lt; 10; j ++) {img [i] [j] = 0; }}
int img [10] ] [10]; Int startRow, startCol, width, height, color; StartRow = 2; StartCol = 3; Width = 3; Height = 3; For color = 1 (int i = 0; i & lt; 10; i ++) {for (int j = 0; j & lt; 10; j ++) {img [startrow] [] = width + i ; // wrong IMG [Start] [startCol] = height + i; // what i am doing img [i + width] [j + height] = color; // program crashes}}
int img [10] [10]; For (int i = 0; i & lt; 10; i ++) {for (int j = 0; j & lt; 10; j ++) {img [i] [j] = 0; }}
img [i] [j] = j;
for
(int i = 1; i < = 3; i ++) {for (int j = 2; j and lt; = 4; j ++) {img [i] [j] = 1; }}
Comments
Post a Comment