C/C++の宿題片付けます 167代目
■ このスレッドは過去ログ倉庫に格納されています
0680デフォルトの名無しさん
2014/07/10(木) 01:30:37.84ID:7fc4wVJQtypedef struct{
char name[20];
int height;
int weight;
}student;
student swap(student sato,student tanaka, student max){
if(sato.height>tanaka.height)max=sato;
if(tanaka.height>sato.height)max=tanaka;
return max;
}
main(){
student sato={"Sato",178,64};
student tanaka={"Tanaka",165,69};
student max;
swap(sato,tanaka,max);
printf("%s: height=%d weight=%d\n",max.name,max.height,max.weight);
return 0;
}
戻り値を用いてheightの大きいほうのデータを出力したいのですが表示されません。
初心者以下の自分にはさっぱりなので間違っている部分を教えてください。
■ このスレッドは過去ログ倉庫に格納されています