标签:
//非递归方法实现,如下: #include "stdafx.h" #include <iostream> using namespace std; int main() { int F[100],num; F[0] = 0; F[1] = 1; for (int i = 2; i < 100; i++) { F[i] = F[i - 1] + F[i - 2]; } cout << "请输入你要显示的斐波那契数列的元素数:" << endl; cin >> num; cout << "显示如下:" << endl; for (int i = 0; i < num; i++) { cout << F[i] << " "; } getchar(); return 0; }
标签:
原文地址:http://www.cnblogs.com/520wy/p/5598245.html