c语言 求对数问题,2013-06-03 17:59 #include"stdio.h" #include"math.h" void main() { double a,b; a=2*3.14-1; b=log5(sqrt(a)); printf("%f\n"); getchar(); }error C2065: 'log5' : undeclared identifier 应怎样改啊?谢谢
满意回答检举|2013-06-04 17:34 C语言中没有以任意为底数的对数函数,所以log5是没有的。所以可以用logx(y)=log(y)/log(x)来代替,修改代码如下 #include"stdio.h" #include"math.h" void main() { double a,b; a=2*3.14-1; b=log(sqrt(a))/log(5); printf("%f\n",b); getchar(); } |
|