Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

THE ANSWER TO THIS PROBLEM IS C........I just need help understanding how to get

ID: 3858697 • Letter: T

Question

THE ANSWER TO THIS PROBLEM IS C........I just need help understanding how to get that answer

Thank you

The following structures are designed to store information about objects in a Cartesian coordinate system 9. struct point fint x, y): struct rectangle sint upper left x, upper left_y, lower_right x, lower_right y;) A point structure stores the x and y coordinates of a point. A rectangle structure stores the coordinates of the upper left and lower right corners of a rectangle. Which of the following functions will correctly determine whether a point p lies within rectangle r, return 1(true) or O(false)? a) int is-inside (struct point p, struct rectangle r){ return p.x > r. upper-left-y r.upper-left-x && p.x r.upper-left-y r. lower-right-x && p.x = r.upper-left-X && p.x = r. upper-left-x && r . upper-left-y; } && r. lower-right-X r. lower-right-y p.x = && p-Y

Explanation / Answer

9.

Answer (d)

int is_inside(struct poin p, struct rectangle r)

{

return p.x >= r.lower_right_x && p.x <= r.upper_left_x && p.y >= r.lower_right_y && p.y <= r.upper_left_y);

}

because in the program it has given that, the struct stores the coordinates of the upper left and lower right corner of the rectangle.