作者Keven (Keven)
看板NTUEE108HW
標題[作業] 計程Ch3.41的最大Fibonacci數
時間Sun Oct 31 23:33:07 2004
我用int時可以印出最大的Fibonacci number
可是使用double時卻跑不出來
以下是我的程式碼
for( double Counter=2; Counter<=99999; Counter++ ){
Fib = X + Y;
if( Fib <=0 )
break;
X = Y;
Y = Fib;
}
cout << "The largest double Fibonacci number that can be printed is " << Y <
< endl;
有那位天才的同學可以告訴我錯在那嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.239.180
推 timrau:double可以用++嗎? 140.112.25.138 10/31
推 timrau:噢不 好像是出現inf了 140.112.25.138 10/31