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