cout float的显示问题

在c++,使用cout直接显示float类型的数据,在不同系统上显示方式可能有所不同。
测试代码:
#include <iostream>

using namespace std;

int main()
{
float t=0.000000277;
cout<<t<<endl;
return 0;
}

在LINUX上:

2.77e-07

而在WINDOWS上结果如下:

2.77e-007

This entry was posted in Linux, Program and tagged , , , . Bookmark the permalink.

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please copy the string Gz7IZV to the field below:

以新浪微博帐号登录