C语言中使用数学函数
C语言中使用数学函数,例如:exp等
1、包含头文件
#include <math.h>
2、编辑源码testExp.c,例如:
#include<stdio.h> #include<math.h> int main() { double m = 4; //为变量赋初值 double n = exp(m); //求双精度数m的指数函数值 printf("%lf\n", n); return 0; }
3、编译时需加上库的链接
gcc testExp.c -lm -o testExp
4、执行:
./testExp
结果:54.598150
人就像是被蒙着眼推磨的驴子,生活就像一条鞭子;当鞭子抽到你背上时,你就只能一直往前走,虽然连你也不知道要走到什么时候为止,便一直这么坚持着。