Hi,
I want to use round(4.47) -
http://www.cplusplus.com/reference/cmath/round/
I expect to see this:
But I see:
1 2 3 4 5 6 7 8 9 10
|
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
int main(int argc, char** argv) {
int x = round(4.47);
cout << "round(4.47) = " << x << endl;
return 0;
}
|
Last edited on
4.47 is closer to 4 than it is to 5, so round() returns 4. The function ceil() does what you expect this to do.