#include <stdio.h>
typedef struct{
int id;
int weight;
int height;
}Body;
void swap(Body *i,Body *j);
int main(void){
Body a[]=
{{1,65,169},
{2,73,170},
{3,59,161},
{4,79,175},
{5,55,168}};
int n= sizeof(a)/sizeof(a[0]);
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<5;i++){
printf("%d,%d,%d\n",a
[i
].
id,a
[i
].
weight,a
[i
].
height); }
return 0;
}
void swap(Body*i,Body*j ){
Body a=*i;
*i=*j;
*j=a;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHN0cnVjdHsKCWludCBpZDsKCWludCB3ZWlnaHQ7CglpbnQgaGVpZ2h0Owp9Qm9keTsKCnZvaWQgc3dhcChCb2R5ICppLEJvZHkgKmopOyAgCmludCBtYWluKHZvaWQpewoKQm9keSBhW109CiAgICAgICB7ezEsNjUsMTY5fSwKICAgICAgIHsyLDczLDE3MH0sCiAgICAgICB7Myw1OSwxNjF9LAogICAgICAgezQsNzksMTc1fSwKICAgICAgIHs1LDU1LDE2OH19OwoKaW50IG49IHNpemVvZihhKS9zaXplb2YoYVswXSk7Cgpmb3IoaW50IGk9MDtpPG4tMTtpKyspewpmb3IoaW50IGo9MDtqPG4taS0xO2orKyl7CglpZihhW2pdLmhlaWdodDxhW2orMV0uaGVpZ2h0KXsKCQlzd2FwKCZhW2pdLCZhW2orMV0pOwoJfQp9Cn0KZm9yKGludCBpPTA7aTw1O2krKyl7CglwcmludGYoIiVkLCVkLCVkXG4iLGFbaV0uaWQsYVtpXS53ZWlnaHQsYVtpXS5oZWlnaHQpOwp9CgoJcmV0dXJuIDA7Cn0Kdm9pZCBzd2FwKEJvZHkqaSxCb2R5KmogKXsKQm9keSBhPSppOwoqaT0qajsKKmo9YTsKfQoKCg==
4,79,175
2,73,170
1,65,169
5,55,168
3,59,161