| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1416 人关注过本帖
标题:cout
只看楼主 加入收藏
youxiaxyz
Rank: 1
等 级:新手上路
帖 子:85
专家分:0
注 册:2006-4-5
收藏
 问题点数:0 回复次数:4 
cout
请问cout的输出格式
比如有一小数是0.879 应该 样设置cout的输出格式才能输出.879 在线等 谢谢
搜索更多相关主题的帖子: cout 小数 格式 输出 
2007-08-03 10:34
youxiaxyz
Rank: 1
等 级:新手上路
帖 子:85
专家分:0
注 册:2006-4-5
收藏
得分:0 
这个论坛好像没有光顾哦
2007-08-03 10:46
热情依然
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:22
帖 子:715
专家分:0
注 册:2005-4-5
收藏
得分:0 
Remarks

Supports the manipulators in ios.

The type is a bitmask type T1 that describes an object that can store format flags. The distinct flag values (elements) are:

  • dec, to insert or extract integer values in decimal format.

  • hex, to insert or extract integer values in hexadecimal format.

  • oct, to insert or extract integer values in octal format.

  • showbase, to insert a prefix that reveals the base of a generated integer field.

  • internal, to pad to a field width as needed by inserting fill characters at a point internal to a generated numeric field. (For information on setting the field width, see setw).

  • left, to pad to a field width as needed by inserting fill characters at the end of a generated field (left justification).

  • right, to pad to a field width as needed by inserting fill characters at the beginning of a generated field (right justification).

  • boolalpha, to insert or extract objects of type bool as names (such as true and false) rather than as numeric values.

  • fixed, to insert floating-point values in fixed-point format (with no exponent field).

  • scientific, to insert floating-point values in scientific format (with an exponent field).

  • showpoint, to insert a decimal point unconditionally in a generated floating-point field.

  • showpos, to insert a plus sign in a nonnegative generated numeric field.

  • skipws, to skip leading white space before certain extractions.

  • unitbuf, to flush output after each insertion.

  • uppercase, to insert uppercase equivalents of lowercase letters in certain insertions.

In addition, several useful values are:

  • adjustfield, a bitmask defined as internal | left | right

  • basefield, defined as dec | hex | oct

  • floatfield, defined as fixed | scientific

    以上是MSDN的说明,但是我没有看到楼住要的东西,请自己写函数进行转换


c++/C + 汇编 = 天下无敌
2007-08-05 00:11
vfdff
Rank: 6Rank: 6
等 级:侠之大者
威 望:8
帖 子:2172
专家分:425
注 册:2005-7-15
收藏
得分:0 
回复:(youxiaxyz)cout
纯理论研究?还是真的需要呢

~~~~~~~~~~~~~~~好好学习~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2007-09-07 11:42
热情依然
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:22
帖 子:715
专家分:0
注 册:2005-4-5
收藏
得分:0 

实际上完全可以转换成字符串来输出


c++/C + 汇编 = 天下无敌
2007-09-08 20:02
快速回复:cout
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015463 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved