//函数的递归
#include <iostream>
using namespace std;
int fib(int n);
int main()
{
int n,answer;
cout<<“Enter Number to find:”;
cin>>n;
cout<<“nn”;
answer=fib(n);
cout<<answer<<” is the “<<n;
cout<<“th Fibonacci numbern”;
return 0;
}
int fib(int n)
{
cout<<“Processing fib(“<<n<<“)…”;
if(n<3)
{
cout<<“Return 1!n”;
return (1);
}
else
{
cout<<“Call fib(“<<n-2<<“) “;
cout<<“and fib(“<<n-1<<“).n”;
return (fib(n-2)+fib(n-1));
}
}