Divide operand

To anyone who may know how to help;

I have a line of c++ code that was giving me a wrong answer when it ran, it gave an answer of 0. The code as written was:

d_CB = 3 / 8 * dens_liq / (dens_liq - dens_gas) * f_M * pow(V_M, 2) / (g * cos(slope));

When I corrected the code to the following, it worked:
d_CB = 0.375 * dens_liq / (dens_liq - dens_gas) * f_M * pow(V_M, 2) / (g * cos(slope));

All of my variables were assigned as doubles. Can anyone provide input as to what the error related to? I need to find out to be able to check that I don't have any other similar errors in my code.

Thanks a bunch.
> 3 / 8
because the operands are integers, the result is an integer
So, 3/8 is 0.
I think I understand now and where else I may have issues...
thanks
Topic archived. No new replies allowed.