#include <math.h>
#define PI acos(-1)
主要是利用利用数学函数中的反三角函数,但是要注意一定引入math包
arccos
(
−
1
)
=
π
\arccos(-1)=\pi
arccos(−1)=π
完整示例:
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
#define PI acos(-1)
int main()
{
printf("%.30lf\n",PI);
return 0;
}
结果:
位数一般够了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)