题目描述
•计算一个数字的立方根
input:216
output:6.0
【代码】
- int main()
- {
- double n;
- cout<<fixed;
- cout.precision(1);
-
- while(cin>>n)
- cout<<(double)exp(1.0 / 3*log(n)) <<endl;
- }
- /*用库函数:
- while(scanf("%lf",&n) ==1)
- {
- printf("%.1f",cbrt(n)); //保留一位小数
- }
•计算一个数字的立方根
input:216
output:6.0
【代码】