//
//
//  fibonacci.cc
//
//      AUTHOR: Russell Lowke
//         T.F: Francis Crick
//  CSCIE-s111: Unit Four, Main - question 1 [worth 10pts],  7/11/2002
//
// Description: Calculates the Fibonacci sequence via a recursive function
// 				called fibo. 
//
//				In this case we are using fibo to estimate the number of mature
//				rabit pairs after a twelve month period, starting with a
//				single infant rabbit pair.
//


#include <iostream>
#include <iomanip>

//
//  find number of "mature rabbits"
//  recursive call that calculates the fibonacci sequence
int fibo (int monthN)
{
	if (monthN <= 1)				// return for values < 1
		return(0);
	else if (monthN <= 3)			// return the base case
		return(1);
	else
		return(fibo(monthN - 1) + fibo(monthN-2));	// recursion
}


//
//  print the number of mature rabbit pairs
//
void rabbits (int limitN)
{
	for (int i = 1; i <= limitN; i++)	// iterate through limitN
    {
		cout << "At the end of month #" << i << ", there are " << fibo(i)
			 << " mature rabbit pairs." << endl;	// print
    }
}


//
//  print 12 months of rabbit
//
void main()
{
	rabbits(12);						// 12 iterations of rabbit
	
	exit(0);
}
