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