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},