Conversion from double to integer [duplicate]
问题 This question already has answers here : C++: How to round a double to an int? [duplicate] (5 answers) round() for float in C++ (21 answers) Closed 5 years ago . I am stuck in problem where the double number is not getting properly converted to integer. In this case-> int x=1000; double cuberoot=pow(x,(1/(double)3)); int a=cuberoot; cout<<"cuberoot="<<cuberoot<<endl; cout<<"a="<<a<<endl; Output: cuberoot=10 a=9 Why here a=9 and not 10? Any solution to this problem?? Also I don't want to round