The Standard Library doesn’t have a function for rounding floating point variables. However, you can easily round numbers as follows:
double d=42.666;int rounded=d+0.5; // rounded = 43d=rounded; // d is now 43.0
size=3>
In other words, adding 0.5 to a floating point value and then converting the result to int has the effect of rounding the original value. You can then assign the resulting int to a float variable.