#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}};
int n = sizeof(data)/sizeof(data[0]);
for(int i=0;i<n-1;i++){
for(int j=0;j<n-i-1;j++){
if(data[j].height<data[j+1].height){
swap(&data[j],&data[j+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+Cgp0eXBlZGVmIHN0cnVjdHsKCWludCBJRDsKCWludCB3ZWlnaHQ7CglpbnQgaGVpZ2h0Owp9Qm9keTsKCnZvaWQgc3dhcChCb2R5ICppLEJvZHkgKmopOwoKaW50IG1haW4odm9pZCkgewoJQm9keSBkYXRhW10gPSB7ezEsNjUsMTY5fSx7Miw3MywxNzB9LHszLDU5LDE2MX0sezQsNzksMTc1fSx7NSw1NSwxNjh9fTsKCQoJaW50IG4gPSBzaXplb2YoZGF0YSkvc2l6ZW9mKGRhdGFbMF0pOwoJCglmb3IoaW50IGk9MDtpPG4tMTtpKyspewoJCWZvcihpbnQgaj0wO2o8bi1pLTE7aisrKXsKCQkJaWYoZGF0YVtqXS5oZWlnaHQ8ZGF0YVtqKzFdLmhlaWdodCl7CgkJCQlzd2FwKCZkYXRhW2pdLCZkYXRhW2orMV0pOwoJCQl9CgkJfQoJfQoKCWZvcihpbnQgaT0wO2k8NTtpKyspewoJCXByaW50ZigiJWQuJWQuJWRcbiIsZGF0YVtpXS5JRCxkYXRhW2ldLndlaWdodCxkYXRhW2ldLmhlaWdodCk7Cgl9CgkKCXJldHVybiAwOwp9Cgp2b2lkIHN3YXAoQm9keSAqaSxCb2R5ICpqKXsKCglCb2R5IGEgPSAqaTsKCSppID0gKmo7CgkqaiA9IGE7Cn0K