#include <iostream> using namespace std; void Fibonacci(int n) { unsigned int a = 1, b = 1; cout << a << '\t' << b << '\t'; for (int t = 3; t <= n; ++t) { b = a + b; a = b - a; cout << b << '\t'; } } int main() { unsigned int n; cout << "请输入正整数n:"; cin >> n; cout << "斐波那契数列的前n项为:" << endl; Fibonacci(n); cout << endl; return 0; }