Geometry/Points and Lines/191.cpp
// Given three colinear points p, q, r, the function checks if
// point q lies on line segment 'pr'
Given three colinear points p, q, r, the function checks if
point q lies on line segment 'pr'
Given three colinear points p q r the function checks if point q lies on line segment ' pr '
bool onSegment(point p, point q, point r)
{
    if (q.x <= max(p.x, r.x) && q.x >= min(p.x, r.x) &&
        q.y <= max(p.y, r.y) && q.y >= min(p.y, r.y))
       return true;
    return false;
}
bool onSegment ( point p , point q , point r ) { if ( q . x <= max ( p . x , r . x ) && q . x >= min ( p . x , r . x ) && q . y <= max ( p . y , r . y ) && q . y >= min ( p . y , r . y ) ) return true ; return false ; }
Given three colinear points p, q, r, the function checks if
point q lies on line segment 'pr'
Given three colinear points p q r the function checks if point q lies on line segment ' pr '