不知道错在哪儿了,运行结果很是诡异啊
/*用迭代公式求平方根*/#include<iostream.h>
#include<math.h>
void main()
{double x,x0,m;
x=1.0;
m=2.0;
do
{x0=x;
x=1/2*(x0+m/x0);
}
while(fabs((x-x0)/x)>1.0e-10);
cout<<"The result is:"<<x<<endl;
}
各位大哥大姐, 帮我看看有什么错误啊
2012-03-22 15:33
2012-03-22 19:36
2012-03-22 21:40
2012-03-23 14:49
2012-03-23 15:35
2012-03-23 15:39