编程论坛
注册
登录
编程论坛
→
C++教室
5的平方根,精确到小数点后500位
hywCCC
发布于 2013-07-20 17:13, 1313 次点击
这个好像要一步一步来的
,有没有大神用C++代码打出来?
5 回复
#2
yuccn
2013-07-20 19:33
5的根号估计没有人对他有兴趣把,又不是什么特殊的数字,比如pi,e之类的
#3
qunxingw
2013-07-20 20:45
初中学过笔算开方,估计那方法可能可以,现在没印象了
#4
未未来
2013-07-21 23:33
程序代码:
#include
<iostream>
#include
<math.h>
#include
<iomanip>
using
namespace
std;
int
main(){
cout
<<fixed<<setprecision(
500
);
cout
<<sqrt(
5
)<<endl;
return
0
;
}
#5
岁月如刀
2013-07-21 23:49
以下是引用
未未来
在2013-7-21 23:33:44的发言:
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
int main(){
cout<<fixed<<setprecision(500);
cout<<sqrt(5)<<endl;
return 0;
}
呵呵,好歹你也应该试一下,太不负责了哦~~
#6
root2008
2018-08-07 15:19
太简单了吧
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
long double a;
a=sqrt(5);
cout<<setiosflags(ios::fixed)<<setprecision(500)<<a;
return 0;
}
Dev C++测试只有100多位,是人也知道long double的容量……
1