第一种方法:cout<<fixed<<setprecision(20)<<mydouble<<endl;
#include#include using namespace std;int main(){ double aDouble = 5.141592694827862736487362746374637434343434; cout< < < <
第二种方法:cout.precision(dbl::digits);
#includeusing namespace std;int main(){ typedef numeric_limits< double > dbl; double pi = 3.141592694827862736487362746374637434343434; cout.precision(dbl::digits10); cout << "Pi: " << fixed << pi << endl; return 0;}