作者ric2k1 (Ric)
看板EE_DSnP
標題[討論] HW#4 problem1 只 show 出小數點下五位數字?
時間Thu Nov 1 23:08:09 2007
第一題跑的結果
電腦總只顯示小數後五位
為什麼呢??
======================
By default, the precision for cout is 6 digits.
Please try to Google "setprecision C++".
For this problem, try:
cout << fixed << setprecision(10) << ...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.121.132.222
1F:推 ally01202:解決! 可是我的iterations不是199999999... 11/01 23:21
2F:推 ric2k1:你多加了, 第一項 "4" 應該不算... 11/01 23:32
3F:推 ally01202:還是多了2... 我出現200000002... 11/01 23:34
4F:推 ric2k1:Try set accuracy = 4.0. The iteration should be 0... 11/01 23:44
5F:推 DoraBoy:為什麼我打出 cout << fixed << setprecision(10) << 會 11/01 23:45
6F:→ DoraBoy:出現`setprecision' undeclared (first use this function 11/01 23:46
7F:推 ally01202:include<iomanip> 11/01 23:49
8F:推 ilway25:#include <iomanip> 11/01 23:49
9F:→ ilway25:囧慢了一步= = 11/01 23:50