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