#include <stdio.h>
typedef struct {
int ID;
int weight;
int height;
}Body;
void swap( Body *x,Body *y){
Body temp=*x;
*x=*y;
*y=temp;
}
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;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgoJCnR5cGVkZWYgc3RydWN0IHsKCQlpbnQgSUQ7CgkJaW50IHdlaWdodDsKCQlpbnQgaGVpZ2h0Owp9Qm9keTsKCnZvaWQgc3dhcCggQm9keSAqeCxCb2R5ICp5KXsKCUJvZHkgdGVtcD0qeDsKCSp4PSp5OwoJKnk9dGVtcDsKfQoKaW50IG1haW4odm9pZCkgewoJQm9keSBhW109ewoJCXsxLDY1LDE2OX0sCgkJezIsNzMsMTcwfSwKCQl7Myw1OSwxNjF9LAoJCXs0LDc5LDE3NX0sCgkJezUsNTUsMTY4fSwKCX07CgkKCWZvcihpbnQgaT0wO2k8NDtpKyspewoJCWZvcihpbnQgaj1pKzE7ajw1O2orKyl7CgkJCWlmKGFbaV0uaGVpZ2h0PGFbal0uaGVpZ2h0KXsKCQkJCXN3YXAoJmFbaV0sJmFbal0pOwoJCQl9CgkJfQoJfQoJCglmb3IoaW50IGk9MDtpPDU7aSsrKXsKCQlwcmludGYoIiVkLCVkLCVkXG4iLGFbaV0uSUQsYVtpXS53ZWlnaHQsYVtpXS5oZWlnaHQpOwoJfQoJcmV0dXJuIDA7Cn0K
4,79,175
2,73,170
1,65,169
5,55,168
3,59,161