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

后端 未结 8 1991
你的背包
你的背包 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 02:47

    include 
    std::pow(n, 1./3.)
    

    Also, in C++11 there is cbrt in the same header.

    Math for Dummies.

提交回复
热议问题