c++ - expressions doesn't return float value -
this question has reply here:
dividing 1/n returns 0.0 2 answerswhen seek calculate expression, integer result, it's like:
float k= 5/12; std::cout<< k<<std::endl;
the output in console 0.
in c/c++, integer division:
5/12
what want floating point division:
5.0/12.0
please note has absolutely nothing glut or opengl.
c++
No comments:
Post a Comment