How can I obtain the cube root in C++?

后端 未结 8 1942
你的背包
你的背包 2020-12-09 02:12

I know how to obtain the square root of a number using the sqrt function.

How can I obtain the cube root of a number?

8条回答
  •  醉梦人生
    2020-12-09 03:01

    Actually the round must go for the above solutions to work.

    The Correct solution would be

    ans = round(pow(n, 1./3.));

提交回复
热议问题