round function in c++
The round
function in C++ is used to round a floating-point number to the nearest integer. It follows the round half to even method also known as "bankers' rounding". The function takes a single argument which is the floating-point number you want to round. If the argument is of type float
, the return value is also of type float
. If the argument is of type double
, the return value is of type double
. If the argument is of type long double
, the return value is of type long double
.