Please send questions to st10@humboldt.edu .
//------------------------------------------------------
// File: fib.cpp
// Name: Sharon Tuttle
// last modified: 1-28-05
//
// Contract: fib : int -> int
//
// Purpose: return the number in the <position> position in the
//    Fibonacci sequence, assuming that 1 is in the 1st 
//    position, 1 is also in the 2nd position, 2 is in the 3rd 
//    position, etc.
//
// preconditions: 
//    *   <position>  >= 1
//
// postconditions:
//    *   returns the number in the <position> position in the
//        Fibonacci sequence
//
// Examples: 
//         fib(1) == 1
//         fib(2) == 1
//         fib(3) == 2
//         fib(8) == 21
//---------------------------------------------------------------------

#include <cassert>
using namespace std;

int fib(int position)
{
    assert(position >= 1);

    // base caseS!
    if ((position == 1) || (position == 2))
    {
        return 1;
    }
    
    // recursive case
    else
    {
        return fib(position-1) + fib(position-2);
    }
}