我的代码:
std::vector<double> thePoint(4);
thePoint[0] = 86;
thePoint[1] = -334.8836574;
thePoint[2] = 24.283;
thePoint[3] = 345.67675;
ofstream file1(tempFileName, ios::trunc);
file1 << std::setprecision(16) << thePoint[0] << " ";
file1 << std::fixed << std::setprecision(2) << thePoint[1] << " ";
file1 << std::setprecision(16) << thePoint[2] << " ";
file1 << std::setprecision(16) << thePoint[3];
我得到:
86 -334.88 24.28300000000000 345.6767500000000
我想:
86 -334.88 24.283 345.67675
与其他挑剔代码的接口需要奇怪的格式。