So you're writing a Gomoku game then?
To check for 5 in a row you just need some loop. For each of the 8 directions set up some deltas between -1 and 1 for each of the x and y directions, then loop in that direction until you hit an edge or you've iterated overy 5 pieces.
Something roughly like:
Code:
static const int xdirs[] = {0,1,1,1,0,-1,-1,-1};
static const int ydirs[] = {-1,-1,0,1,1,1,0,-1};
for (int i=0; i<8; ++i)
{
int x = startx, y = starty, numInARow=0;
for (int j = 0; j < 5 && IsWithinBoard(x, y); ++j)
{
// *** Test this cell here, maybe increment numInARow ***
x += xdirs[i];
y += ydirs[i];
}
}
Just give it a shot and see how you go.