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