string isPointInRect(int pointx, int pointy, int x, int y, int width, int height)
{
if ((pointx < x) || (pointy < y) ||
(pointx > (x + width)) || (pointy > (y + height))) {
return "out";
} else if ((pointx == x) && (pointy >= y && pointy <= y + height) ||
(pointy == y) && (pointx >= x && pointx <= width)) {
return "on";
} else if ((pointx > x) && (pointy > y) &&
(pointx < (x + width)) && (pointy < (y + height))) {
return "in";
}
}
网友评论