作者naruto1031 (毛毛)
看板NTUBIME101HW
標題Re: [C++] 費事數列-loop
時間Thu Oct 23 21:55:47 2008
#include "stdafx.h"
#include "iostream"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
double a = 0, b = 1 ,c;
cout << a <<endl<< b<<endl ;
for (int i = 0; i<100 ; i++)
{
c = a+b;
a = b;
b = c;
cout << c << endl;
}
system("pause");
return 0;
}
不知道這樣有沒有比較短
--
因為羈絆----
所有的一切 無論好與壞 都是這個現實的世界留給我們每個人的羈絆
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.99.4.209
※ 編輯: naruto1031 來自: 122.99.4.209 (10/23 21:56)