- C/C++の宿題片付けます 167代目
680 :デフォルトの名無しさん[sage]:2014/07/10(木) 01:30:37.84 ID:7fc4wVJQ - #include <stdio.h>
typedef 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の大きいほうのデータを出力したいのですが表示されません。 初心者以下の自分にはさっぱりなので間違っている部分を教えてください。
|