class BOX
{
int center_x;
int center_y;
int width;
int height;
public BOX()
{
//initialize center width,height
}
boolean IsOnBox(int x,int y);
{
return ( (x >= center_x - width/2) && (x <= center_x + width/2) && (y>=center_y- height/2) && (y <= center_x-height/2) )
}
}
Wednesday, September 30, 2009
Given a point with co-ordinates x, y write a function to check if it lies in a box whose center co-ordinates, width and height are known.
Subscribe to:
Post Comments (Atom)
Looks good. Provide the test data you've tested the program against
ReplyDelete