VM pow 函数 :undefined reference to `pow'
具体解决办法
在你编译的最后加上 -lm 即可
代码一览:
pow.c
#include <stdio.h>
#include <math.h>
int main()
{
float p1 = 0.25, p2 = 0.8;
float p3 = pow(p1,p2);
printf("pow(0.25,0.8) is %f;\n",p3);
return 0;
}
powh.c(税率问题)
#include <stdio.h>
#include <math.h>
int main()
{
float r0 = 0.0072,r1 = 0.0414,r2 = 0.0468,r3 = 0.054,r5 = 0.0585;
float p1,p2,p3,p4,p5;
p1 = 1000*(1+5*r5);
p2 = 1000*(1+2*r2)*(3*r3);
p3 = 1000*(1+3*r3)*(2*r2);
p4 = 1000*(1+r1)*(1+r1)*(1+r1)*(1+r1)*(1+r1);
p5 = 1000*pow(1+r0/4,20);
printf("%f \n%f \n%f \n%f \n%f \n",p1,p2,p3,p4,p5);
return 0;
}