In the function round of Display 3.6, which of these explains what happens in the body of the function? We reproduce the one line from the function body here: return static_cast(floor(number+0.5));

a) This is overkill, it would be sufficient to use the floor function alone.
b) Adding 0.5 to number pushes the range up so floor can produce the correct
rounding.
c) The static_cast is used because floor returns a double. If the
double value were returned, there would be at least a warning of a double to
int conversion in returning the value.
d) This is wrong. The argument for the floor function should be number-0.5.

b) Adding 0.5 to number pushes the range up so floor can produce the correct
rounding.
c) The static_cast is used because floor returns a double. If the
double value were returned, there would be at least a warning of a double to
int conversion in returning the value.

Computer Science & Information Technology

You might also like to view...

The password policy setting that determines the minimum number of days a password must be used before it can be changed is Password Must Meet Complexity Requirements

Indicate whether the statement is true or false

Computer Science & Information Technology

A function ends with a(n) ____ statement.

A. End Function B. Exit Function C. Function D. Exit

Computer Science & Information Technology