youxiaxyz 发表于 2007-8-3 10:34

cout

请问cout的输出格式<BR>比如有一小数是0.879 应该 样设置cout的输出格式才能输出.879 在线等 谢谢<BR>

youxiaxyz 发表于 2007-8-3 10:46

这个论坛好像没有光顾哦

热情依然 发表于 2007-8-5 00:11

Remarks
<DIV>
<P>Supports the manipulators in <a href="ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.VisualStudio.v80.chs/dv_vcstdlib/html/d3d4c161-2f37-4f04-93cc-0a2a89984a9c.htm" target="_blank" >ios</A>.</P>
<P>The type is a bitmask type <B>T1</B> that describes an object that can store format flags. The distinct flag values (elements) are:</P>
<UL>
<LI>
<P><B>dec</B>, to insert or extract integer values in decimal format.</P>
<LI>
<P><B>hex</B>, to insert or extract integer values in hexadecimal format.</P>
<LI>
<P><B>oct</B>, to insert or extract integer values in octal format.</P>
<LI>
<P><B>showbase</B>, to insert a prefix that reveals the base of a generated integer field.</P>
<LI>
<P><B>internal</B>, 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 <a href="ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.VisualStudio.v80.chs/dv_vcstdlib/html/d0a954d0-a8d1-4b44-a06e-e953be912239.htm" target="_blank" >setw</A>).</P>
<LI>
<P><B>left</B>, to pad to a field width as needed by inserting fill characters at the end of a generated field (left justification).</P>
<LI>
<P><B>right</B>, to pad to a field width as needed by inserting fill characters at the beginning of a generated field (right justification).</P>
<LI>
<P><B>boolalpha</B>, to insert or extract objects of type <B>bool</B> as names (such as <B>true</B> and <B>false</B>) rather than as numeric values.</P>
<LI>
<P><B>fixed</B>, to insert floating-point values in fixed-point format (with no exponent field).</P>
<LI>
<P><B>scientific</B>, to insert floating-point values in scientific format (with an exponent field).</P>
<LI>
<P><B>showpoint</B>, to insert a decimal point unconditionally in a generated floating-point field.</P>
<LI>
<P><B>showpos</B>, to insert a plus sign in a nonnegative generated numeric field.</P>
<LI>
<P><B>skipws</B>, to skip leading white space before certain extractions.</P>
<LI>
<P><B>unitbuf</B>, to flush output after each insertion.</P>
<LI>
<P><B>uppercase</B>, to insert uppercase equivalents of lowercase letters in certain insertions.</P></LI></UL>
<P>In addition, several useful values are:</P>
<UL>
<LI>
<P><B>adjustfield</B>, a bitmask defined as <B>internal</B> | <B>left</B> | <B>right</B></P>
<LI>
<P><B>basefield</B>, defined as <B>dec</B> | <B>hex</B> | <B>oct</B></P>
<LI>
<P><B>floatfield</B>, defined as <B>fixed</B> | <B>scientific<BR><BR>以上是MSDN的说明,但是我没有看到楼住要的东西,请自己写函数进行转换</B></P></LI></UL></DIV>

vfdff 发表于 2007-9-7 11:42

回复:(youxiaxyz)cout

纯理论研究?还是真的需要呢 [em13]

热情依然 发表于 2007-9-8 20:02

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

页: [1]

编程论坛