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

Consider the following struct definitions, which represent a point on the Cartes

ID: 3632434 • Letter: C

Question

Consider the following struct definitions, which represent a point on the Cartesian plane, and a rectangular region on the Cartesian plane, respectively.

struct point {
int x; /* x coordinate */
int y; /* y coordinate */
};

struct rectangle {
struct point bottomLeft;
struct point topRight;
};

Write a function named "sort" that sorts an array of rectangles by area, smallest to largest. The function takes two arguments: an array of struct rectangle, and the size of the array (an integer). If two rectangles have equal area, then their relative order in the sorted array does not matter.

void sort(struct rectangle *array, int size);

You may define additional functions in your solution.

Im honestly not sure were to start, please help!

Thank you!

Explanation / Answer

#include #include #include "apstring.cpp" struct PRINTER_TYPE { apstring brand; int modelNumber; double cost; } ; void sort(apvector &printerStock); int main(void) { apvector printerStock(30); . . . sort (printerStock); . . . } // function to sort array of structures . . . abc order by brand void sort (apvector &printerStock) { PRINTER_TYPE temp; for(int i = 0; i