#include <stdio.h>
struct Body{
int id;
int weight;
int height;
};
void swap(struct Body *x,struct Body *y);
int main(void) {
// your code goes here
struct 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=0;j<4;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(struct Body*x,struct Body*y){
struct Body temp;
temp=*x;
*x=*y;
*y=temp;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CnN0cnVjdCBCb2R5ewoJaW50IGlkOwoJaW50IHdlaWdodDsKCWludCBoZWlnaHQ7Cn07CnZvaWQgc3dhcChzdHJ1Y3QgQm9keSAqeCxzdHJ1Y3QgQm9keSAqeSk7CmludCBtYWluKHZvaWQpIHsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCSBzdHJ1Y3QgQm9keSBhW109e3sxLDY1LDE2OX0sCgkJCSAgIHsyLDczLDE3MH0sCgkJCSAgIHszLDU5LDE2MX0sCgkJCSAgIHs0LDc5LDE3NX0sCgkJCSAgIHs1LDU1LDE2OH19OwoJZm9yKGludCBpPTA7aTw0O2krKyl7CgkJZm9yKGludCBqPTA7ajw0O2orKyl7CgkJCWlmKGFbal0uaGVpZ2h0PGFbaisxXS5oZWlnaHQpewoJCQlzd2FwKCZhW2pdLCZhW2orMV0pOwoJCX0KCQl9Cgl9Cglmb3IoaW50IGk9MDtpPDU7aSsrKXsKCQlwcmludGYoIiVkLCVkLCVkXG4iLGFbaV0uaWQsYVtpXS53ZWlnaHQsYVtpXS5oZWlnaHQpOwoJfQoJCglyZXR1cm4gMDsKfQp2b2lkIHN3YXAoc3RydWN0IEJvZHkqeCxzdHJ1Y3QgQm9keSp5KXsKCXN0cnVjdCBCb2R5IHRlbXA7Cgl0ZW1wPSp4OwoJKng9Knk7CgkqeT10ZW1wOwp9
4,79,175
2,73,170
1,65,169
5,55,168
3,59,161