優(yōu)選答案#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a,x0,x1;
cout<<"請(qǐng)輸入a的值:"<<endl;
cin>>a;
x0=a/2;
x1=(x0+a/x0)/2;
do
{
x0=x1;
x1=(x0+a/x0)/2;
}
while (fabs(x0-x1)>1e-5);
cout<<x1;
}
優(yōu)選答案#include <iostream>
文中圖片素材來(lái)源網(wǎng)絡(luò),如有侵權(quán)請(qǐng)聯(lián)系644062549@qq.com刪除
轉(zhuǎn)載注明出處:http://m.tengyi66.com