I think you’ll kick yourself, all you need to do is use the value variable for both cases.
int rabbit(int n, int parameter)
{
int value;
for(int i = 0; i < parameter; i++)
{
cout << " ";
}
cout << "Enter rabbit: n = " << n << endl;
if(n <=2)
{
value = 1;
}
else
{
value = rabbit(n - 1, parameter + 1) + rabbit(n - 2, parameter + 1);
}
for(int i = 0; i < parameter; i++)
{
cout << " ";
}
cout << "Leave rabbit: n = " << n << " value = " << value << endl;
return value;
}
solved C++ Recursive rabbit assignment