hoffnung hoffnung - 1 year ago 81
C++ Question

round down function using floor(c++)

I want to make a simple function that rounds down a double into integer with one condition. If it rounds down to zero, I want it to return 1.

This is what I made.

int Round(double number)
int result;
return result;

But somehow it always returns 0... Any idea whats wrong with my code?

Its done with c++ in visual studio 2010.

Answer Source

= is used for assignment. Use == for comparison: