Thread: void fibonacci() - Is This Possible?

1. void fibonacci() - Is This Possible?

I'm trying to work on a project that deals with Fibonacci numbers, but the recursive function for fibonacci is void so I can't figure out how to work it. I have to add the code in the if/else statements in the function fibonacci.

This is the code:

Code:
```class fibon
{  unsigned int prev1,    // f(n-1)
prev2;    // f(n-2)
public:
fibon()
{}
void fibonacci(unsigned int month);
};

void fibon::fibonacci(unsigned int month)
{ unsigned int fib;

if (month == 0)
{
}
else if (month == 1)
{
}
else
{
}
*xout << setw(13) << month << setw(16) << fib << endl;
if (xout == &sout && month == 22)  // Stop scrolling.
{  cout << "Press enter to continue.";
cin.ignore(80,'\n');
//delline();
} }```
Is this possible, if so, can you just point me in the right direction.

2. Nevermind, I figured it out.

3. assuming each instance of the fib class is suppose to solve the fib problem, create instances that solve smaller fib problems and use those instances to solve the bigger problem (same basic idea as recursion)