标签:pow math span cst space using str main namespace
1 #include<cstdio> 2 #include<cmath> 3 using namespace std; 4 double at(double x) 5 { 6 double sum=0; 7 int n=1,t=1; 8 double s; 9 while(s>=1e-6) 10 { 11 s=pow(x,n)/n; 12 s=s*t; 13 sum+=s; 14 t=t*(-1); 15 n=n+2; 16 } 17 18 return sum; 19 } 20 int main() 21 { 22 double pi; 23 pi=6*at(1/sqrt(3)); 24 printf("%lf",pi); 25 return 0; 26 }
大家猫猫这个代码有没有问题?怎么改?
标签:pow math span cst space using str main namespace
原文地址:http://www.cnblogs.com/tflsnoi/p/7966631.html