【发布时间】:2017-12-24 22:36:45
【问题描述】:
我在两个不同的操作系统上构建并运行以下代码:
#include <bits/stdc++.h>
using namespace std;
int main(){
double d=1.123456;
printf("%.5lf ",d);
cout<<fixed<<setprecision(5)<<d;
return 0;
}
Ubuntu 输出中的 Code::Blocks:1.12346 1.12346(如预期的那样)
Windows 输出中的代码::块:0.00000 1.12346(为什么是0.00000 !!!)
【问题讨论】:
标签: c++ printf double codeblocks precision