Flag coding to fill a shape?

hi there im a beginner in c++

well ive never used flag before and i was told that i can use flag to this:

i need to fill this shape using flag coding

this code will print out a squared shape with a top
any ideas in how can i fill in this shape using the flag coding

for example in the array i can go like
if [row][column] reached the first 2 it will start filling the shape with a 0 and when it meets the other 2 in the other side it stops and starts a new line
till the shape is filled

i dont know how to use flag here i just know the concept

can anyone help please

this is the code:

#include<iostream>


using namespace std;
int polygon[10][10] = {{1,1,1,1,1,1,1,1,1,1},
{1,1,1,2,2,2,2,1,1,1},
{1,1,1,2,1,1,2,1,1,1},
{1,2,2,2,1,1,2,2,2,1},
{1,2,1,1,1,1,1,1,2,1},
{1,2,1,1,1,1,1,1,2,1},
{1,2,1,1,1,1,1,1,2,1},
{1,2,1,1,1,1,1,1,2,1},
{1,2,2,2,2,2,2,2,2,1},
{1,1,1,1,1,1,1,1,1,1},

};

int main(){

int row,column;
char c='y';

for (int row = 0; row<10; row++)
{
for (int column=0; column <10; column++)
{
if(polygon[row][column]==1) cout << " ";
else if(polygon[row][column]==2)
{

cout << "+";
}
else
cout << " ";
}
cout << "\n";
}
system("pause");

}
Topic archived. No new replies allowed.