标题:请教各位达人,小菜有问待解。
取消只看楼主
小四
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-6-21
 问题点数:0 回复次数:1 
请教各位达人,小菜有问待解。
今天看了这段程序,有些问题不理解,望达人指点。

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{int s=1;
double n=1,t=1,pi=0;
while((fabs(t))>1e-7)
{pi=pi+t;
n=n+2;
s=-s;
t=s/n;
}
pi=pi*4;
cout<<"pi="<<setiosflags(ios::fixed)<<setprecision(6)<<pi<<endl;

return 0;
}



红色部分不是很理解。
搜索更多相关主题的帖子: 小菜 
2007-08-17 21:51
小四
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-6-21
得分:0 

THX


2007-08-17 23:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-163585-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.113669 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved