[C++ ]考古題解答 費朋納西序列

看板NTUBIME103HW作者 (steve)時間15年前 (2010/11/09 21:31), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
這是費氏數列解答 #include "stdafx.h" #include "iostream" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int arr[20]={0}; arr[0]=1; arr[1]=1; cout<<arr[0]<<"\t"; cout<<arr[1]<<"\t"; for(int i=2;i<=19;i++) { arr[i]=arr[i-1]+arr[i-2]; cout<<arr[i]<<"\t"; if(i%5==4) cout<<endl; } system("pause"); return 0; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.161.76.90 ※ 編輯: steve1012 來自: 118.161.76.90 (11/09 21:31)

11/15 09:51, , 1F
維峻大神
11/15 09:51, 1F
文章代碼(AID): #1CsKqMRa (NTUBIME103HW)