关闭浮动的科学记数法 [英] Turn off scientific notation on float

查看:137
本文介绍了关闭浮动的科学记数法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试以标准记数法显示数字

I'm trying to display number in standard notation

例如:

float f = 1230000.76

原来是,

1.23e+006


解决方案

有两件事情发现在iomanip,必须包括....第一是固定的,第二是setprecision

there are two things found in iomanip that must be included....first is fixed and the second is setprecision

写:


cout<固定;

cout<< setprecision(2)<< f;

cout<< fixed;
cout<< setprecision(2)<< f;

固定禁用科学记数法,即1.23e + 006 ....固定是一个粘性操纵器,所以u需要禁用如果你想恢复到科学记数法...

fixed disables the scientific notation i.e. 1.23e+006.... and fixed is a sticky manipulator so u need to disable it if u want to revert back to scientific notation...

这篇关于关闭浮动的科学记数法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆