#include <stdio.h>
typedef struct {
int id;
int weight;
int height;
} Body;
void swap(Body*a, Body*b) {
Body temp= *a;
*a = *b;
*b =temp;
}
int main(void) {
Body a[] = {
{1, 65, 169},
{2, 73, 170},
{3, 59, 161},
{4, 79, 175},
{5, 55, 168}
};
int n =5;
for (int i = 0; i < n ; i++) {
for (int j = i+1; j < n ; j++) {
if (a[i].height< a[j].height) {
swap(&a[i], &a[j]);
}
} printf("ID: %d, Weight: %d, Height: %d\n", a
[i
].
id, a
[i
].
weight, a
[i
].
height); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CnR5cGVkZWYgc3RydWN0IHsKICAgIGludCBpZDsgICAgICAKICAgIGludCB3ZWlnaHQ7ICAKICAgIGludCBoZWlnaHQ7ICAgCn0gQm9keTsKCnZvaWQgc3dhcChCb2R5KmEsIEJvZHkqYikgewogICAgICAgQm9keSB0ZW1wPSAqYTsKICAgICphID0gKmI7CiAgICAqYiA9dGVtcDsKfQppbnQgbWFpbih2b2lkKSB7CiAgICBCb2R5IGFbXSA9IHsKICAgICAgICB7MSwgNjUsIDE2OX0sCiAgICAgICAgezIsIDczLCAxNzB9LAogICAgICAgIHszLCA1OSwgMTYxfSwKICAgICAgICB7NCwgNzksIDE3NX0sCiAgICAgICAgezUsIDU1LCAxNjh9CiAgICB9OwoKICAgICBpbnQgbiA9NTsgCiAgICBmb3IgKGludCBpID0gMDsgaSA8IG4gOyBpKyspIHsKICAgICAgICBmb3IgKGludCBqID0gaSsxOyBqIDwgbiA7IGorKykgewogICAgICAgICAgICBpZiAoYVtpXS5oZWlnaHQ8IGFbal0uaGVpZ2h0KSB7CiAgICAgICAgICAgICAgICBzd2FwKCZhW2ldLCAmYVtqXSk7CiAgICAgICAgICAgIH0gCiAgICAgICAgfSAgcHJpbnRmKCJJRDogJWQsIFdlaWdodDogJWQsIEhlaWdodDogJWRcbiIsIGFbaV0uaWQsIGFbaV0ud2VpZ2h0LCBhW2ldLmhlaWdodCk7CiAgICB9ICAgCiAgICByZXR1cm4gMDsKfQoKCgo=
ID: 4, Weight: 79, Height: 175
ID: 2, Weight: 73, Height: 170
ID: 1, Weight: 65, Height: 169
ID: 5, Weight: 55, Height: 168
ID: 3, Weight: 59, Height: 161