c++精度控制输出
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
double value = 1.2345678901;
cout << value << endl;
cout << setprecision(1) << value << endl;
cout << setprecision(12) << value << endl;
return 0;
}
c精度控制输出
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
double value = 1.2345678901;
printf("%f\n",value);
printf("%.10f\n",value);
return 0;
}