20
Volume is 11.7825 mm
Weight is 235.65 g
that weight is more than 11 times larger than the actual. Computation problem?
maybe get rid of shape, it is not necessary or useful.
1 2 3 4 5
|
if (est_weight > act_weight + 0.10 || est_weight < act_weight - 0.10)
{
return "wedge";
}
return "cylinder";
| |
and in main, make a choice...
shape = wedge_or_cylinder(est_weight, act_weight, shape); //do this
OR DO THIS
cout <<"Volume is " <<est_volume << " mm" << endl;
cout <<"Weight is " <<est_weight << " g" << endl;
cout <<"The shape is a " << wedge_or_cylinder(est_weight, act_weight, shape);
OR make it passed by reference and a void function (no return statements).
shape is not modified by the function because it isnt passed by reference.
you do not use the returned value.