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