We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
typedef struct triangle triangle;
triangle* sort_by_area(triangle* tr, int n) {
/**
* Sort an array a of the length n
/
double p ;
double k = malloc(n * sizeof(double));
;
triangle temp;
for(int i =0; i(p-tr[i].b)(p-tr[i].c));
Small Triangles, Large Triangles
You are viewing a single comment's thread. Return to all comments →
include
include
include
struct triangle { int a; int b; int c; };
typedef struct triangle triangle; triangle* sort_by_area(triangle* tr, int n) { /** * Sort an array a of the length n / double p ; double k = malloc(n * sizeof(double)); ; triangle temp; for(int i =0; i(p-tr[i].b)(p-tr[i].c));
}
int main() { int n; scanf("%d", &n); triangle *tr = malloc(n * sizeof(triangle)); for (int i = 0; i < n; i++) { scanf("%d%d%d", &tr[i].a, &tr[i].b, &tr[i].c); } sort_by_area(tr, n); for (int i = 0; i < n; i++) { printf("%d %d %d\n", tr[i].a, tr[i].b, tr[i].c); } return 0; }