In this task you must write a function that determines


In this task you must write a function that determines whether a point lies inside a rectangle. The point and rectangle are both specified using arrays of floating point values.

Requirements

Write a function that matches the following declaration:

int InRectangle( float pt[2], float rect[4] );

  • Argument pt[2] defines a point on the plane: pt[0] is the x-coordinate, pt[1] is the y-coordinate.
  • Argument rect[4] defines a rectangle on the same plane. rect[0] and rect[1] define the x- and y- cordinates respectively of one corner of the rectangle. rect[2] and rect[3] define the opposite corner.
  • Coordinates may be any valid floating point value, including negative values.
  • The function returns int 0 (false) for any point that lies outside the rectangle, and 1 (true) for any other point (i.e. points inside and on the boundary of the rectangle).

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: In this task you must write a function that determines
Reference No:- TGS01606636

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)