正文

大家好,路过的请帮忙2006-07-29 11:43:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/daweizhao/16961.html

分享到:

我在看钱能的C++书,在第四章求PI过程中遇到了麻烦,下面是我的程序,麻烦请看一下编译时:missing function header (old-style formal list?)Error executing cl.exe.可是少哪个头文件呢?问题可能比较简单,请不要见笑。谢谢。 #include<stdio.h>#include <iostream.h>#include <iomanip.h>#include <math.h> ///求pi,用公式pi/4=1-1/3+1/5+1/7.....直到最后一个的绝对值不大于1e-8{ double sum=0,Lterm=1;int m=-1; for(int n=1;fabs(Lterm)>1e-8;n+=2) {temp1=(-1)*m;Lterm=1/double(n); sum+=temp1*Lterm; }sum=4*sum; cout<<"the pi is "<<sum<<endl;}

阅读(1935) | 评论(2)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

loading...
您需要登录后才能评论,请 登录 或者 注册