#include <stdio.h>
typedef struct{
int ID;
int weight;
int height;
}Body;
void swap(Body *i,Body *j);
int main(void) {
Body data[] = {{1,65,169},{2,73,170},{3,59,161},{4,79,175},{5,55,168}};
for(int i=0;i<5;i++){
for(i=i+1;i<5;i++){
if(data[i].height<data[i+1].height){
swap(&data[i],&data[i+1]);
}
}
}
for(int i=0;i<5;i++){
printf("%d.%d.%d\n",data
[i
].
ID,data
[i
].
weight,data
[i
].
height); }
return 0;
}
void swap(Body *i,Body *j){
Body a = *i;
*i = *j;
*j = a;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHN0cnVjdHsKCWludCBJRDsKCWludCB3ZWlnaHQ7CglpbnQgaGVpZ2h0Owp9Qm9keTsKCnZvaWQgc3dhcChCb2R5ICppLEJvZHkgKmopOwoKaW50IG1haW4odm9pZCkgewoJQm9keSBkYXRhW10gPSB7ezEsNjUsMTY5fSx7Miw3MywxNzB9LHszLDU5LDE2MX0sezQsNzksMTc1fSx7NSw1NSwxNjh9fTsKCQoJZm9yKGludCBpPTA7aTw1O2krKyl7CgkJZm9yKGk9aSsxO2k8NTtpKyspewoJCQlpZihkYXRhW2ldLmhlaWdodDxkYXRhW2krMV0uaGVpZ2h0KXsKCQkJc3dhcCgmZGF0YVtpXSwmZGF0YVtpKzFdKTsKCQkJfQoJCX0KCX0KCglmb3IoaW50IGk9MDtpPDU7aSsrKXsKCQlwcmludGYoIiVkLiVkLiVkXG4iLGRhdGFbaV0uSUQsZGF0YVtpXS53ZWlnaHQsZGF0YVtpXS5oZWlnaHQpOwoJfQoJCglyZXR1cm4gMDsKfQoKdm9pZCBzd2FwKEJvZHkgKmksQm9keSAqail7CgoJQm9keSBhID0gKmk7CgkqaSA9ICpqOwoJKmogPSBhOwp9Cg==