Fibonacci numbers in C++

Example for versions Borland C++ Builder 6, Microsoft Visual C++ 6, Microsoft Visual C++ 9 (2008), g++ 3.4.5

This example uses recursive definition of Fibonacci numbers.

#include <iostream>

int fibonacci(int n)
{
    return ( n<=2 ? 1 : fibonacci(n-1) + fibonacci(n-2) );
}

int main(void)
{
    for (int n=1; n<=16; n++)
        std::cout << fibonacci(n) << ", ";
    std::cout << "..." << std::endl;
    return 0;
}