作者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