作者ric2k1 (Ric)
看板EE_DSnP
标题[讨论] HW#2 的问题
时间Mon Oct 8 00:26:05 2007
有同学在问, 为什麽输入浮点数 (e.g. 6.0), cout 出来却变整数 (6)
这是关於 cout 出来 precision 的问题.
By default, cout 的 precision 是六位数, 而且会将小数点最後面的 0 省略掉.
If you really want to see the 小数点, you can do:
cout << showpoint << n << endl;
where showpoint is an iostream manipulator. We will talk about some of them
in lecture note 3.
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.121.131.190