#include <stdio.h>
// The following code prints out the first five elements of the
// fibonacci series without calculating the values at runtime.
template <int param>
struct CFibonacci
{
static const value;
};
template <int param>
const CFibonacci<param>::value =
CFibonacci<param - 2>::value + CFibonacci<param - 1>::value;
const CFibonacci<0>::value = 0;
const CFibonacci<1>::value = 1;
void main( void )
{
printf( "%d\n", CFibonacci<1>::value );
printf( "%d\n", CFibonacci<2>::value );
printf( "%d\n", CFibonacci<3>::value );
printf( "%d\n", CFibonacci<4>::value );
printf( "%d\n", CFibonacci<5>::value );
}
Saturday, August 15, 1998
Calculating fibonacci series at compile-time
Wednesday, March 1, 1995
Saturday, January 28, 1995
Call DLL functions -- Rules for manually pushing arguments on the stack.
Posted in January, 1995: article link.
Saturday, November 30, 1985
My early antics pre-internet.
It was 1985, and I was reading my favorite computer magazine, Antic and was floored to see my name mentioned in print. I had forgotten, but apparently I wrote a "letter" to the magazine describing some programming trick. I remember seeing the text, "Kudos to Kenny Ksajikian".
My English wasn't so good, so I had to look up "Kudos", which made the phrase stuck in my mind. Decades later I google that term, and ouala --> Kudos' to Kenny Ksajikian.
Subscribe to:
Posts (Atom)
