We need a float
raise function that runs like the code below
math.h
has ceil()
and floor()
but not round()
.
Is it in another C++ library or not at all?
float round(float);
round(0.1) = 0
round(-0.1) = 0
round(-0.9) = -1
Considering that there is only ceil()
and floor()
, it seems to be a C++98 environment.
C++98 does not have a round()
function, so you have to make it yourself.
The code is as follows
float round(float d)
{
return floor(d + 0.5);
}
© 2024 OneMinuteCode. All rights reserved.