#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-1;i++){
for(int j=0;j<n-i-1;j++){
if(a[j].height<a[j+1].height){
swap(&a[j],&a[j+1]);
}
}
}
for(int i=0;i<n;i++){
printf("%d,%d,%d\n",a
[i
].
id,a
[i
].
weight,a
[i
].
height); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHN0cnVjdHsKCWludCBpZDsKCWludCB3ZWlnaHQ7CglpbnQgaGVpZ2h0Owp9Qm9keTsKCnZvaWQgc3dhcChCb2R5ICphLEJvZHkgKmIpewoJQm9keSB0ZW1wPSphOwoJKmE9KmI7CgkqYj10ZW1wOwp9CgppbnQgbWFpbih2b2lkKSB7CglCb2R5IGFbXT17CgkJezEsNjUsMTY5fSwKCQl7Miw3MywxNzB9LAoJCXszLDU5LDE2MX0sCgkJezQsNzksMTc1fSwKCQl7NSw1NSwxNjh9fTsKCQoJaW50IG49NTsKCQoJZm9yKGludCBpPTA7aTxuLTE7aSsrKXsKCQlmb3IoaW50IGo9MDtqPG4taS0xO2orKyl7CgkJCWlmKGFbal0uaGVpZ2h0PGFbaisxXS5oZWlnaHQpewoJCQkJc3dhcCgmYVtqXSwmYVtqKzFdKTsKCQkJfQoJCX0KCX0KCWZvcihpbnQgaT0wO2k8bjtpKyspewoJCXByaW50ZigiJWQsJWQsJWRcbiIsYVtpXS5pZCxhW2ldLndlaWdodCxhW2ldLmhlaWdodCk7Cgl9CglyZXR1cm4gMDsKfQo=
4,79,175
2,73,170
1,65,169
5,55,168
3,59,161