Since someone else has already done it, and it would be unreasonable for OP to turn in a template programming form, I'll go ahead and post this solution.
This question gave me an idea.
Code:
template <unsigned int N>
struct Fibonacci
{
enum{value = Fibonacci<N - 1>::value + Fibonacci<N - 2>::value};
};
template <>
struct Fibonacci<1>
{
enum{value = 1};
};
template <>
struct Fibonacci<2>
{
enum{value = 1};
};
Is there a way to avoid that second specialization, and specify that the specialization for 1 is for 1 and 2?