#include <stdio.h>
typedef struct{
int id;
int weight;
int height;
}Body;
void swap(Body *b, Body *c);
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<4;i++){
for(int j=i+1;j<5;j++){
if(data[i].height<data[j].height){
swap(&data[i],&data[j]);
}
}
}
//for文を使って、表示する
for(int d=0;d<5;d++){
printf("%d\n",data
[d
].
height); }
return 0;
}
void swap(Body *b, Body *c){
Body e;
e = *b;
*b = *c;
*c = e;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHN0cnVjdHsKCWludCBpZDsKCWludCB3ZWlnaHQ7CglpbnQgaGVpZ2h0Owp9Qm9keTsKCnZvaWQgc3dhcChCb2R5ICpiLCBCb2R5ICpjKTsKCmludCBtYWluKHZvaWQpIHsKCUJvZHkgZGF0YVtdID0gewoJCXsgMSwgNjUsIDE2OSB9LAoJCXsgMiwgNzMsIDE3MCB9LAoJCXsgMywgNTksIDE2MSB9LAoJCXsgNCwgNzksIDE3NSB9LAoJCXsgNSwgNTUsIDE2OCB9fTsKCWZvciAoaW50IGk9MDtpPDQ7aSsrKXsKCQlmb3IoaW50IGo9aSsxO2o8NTtqKyspewoJCWlmKGRhdGFbaV0uaGVpZ2h0PGRhdGFbal0uaGVpZ2h0KXsKCQlzd2FwKCZkYXRhW2ldLCZkYXRhW2pdKTsJCgl9Cgl9Cgl9CgkvL2ZvcuaWh+OCkuS9v+OBo+OBpuOAgeihqOekuuOBmeOCiwoJZm9yKGludCBkPTA7ZDw1O2QrKyl7CgkJcHJpbnRmKCIlZCwiLGRhdGFbZF0uaWQpOwoJCXByaW50ZigiJWQsIixkYXRhW2RdLndlaWdodCk7CgkJcHJpbnRmKCIlZFxuIixkYXRhW2RdLmhlaWdodCk7Cgl9CglyZXR1cm4gMDsKfQoKdm9pZCBzd2FwKEJvZHkgKmIsIEJvZHkgKmMpewoJQm9keSBlOwoJZSA9ICpiOwoJKmIgPSAqYzsKCSpjID0gZTsKfQo=
4,79,175
2,73,170
1,65,169
5,55,168
3,59,161