Template programming is quite a challenge.
Simple example: "Write a template struct that determines whether a number is even or odd"
The contest should be harder than that though.Code:template <int num, int mod2=-1> struct Num { static const bool isOdd = Num<num,num%2>::isOdd; }; template <int num> struct Num<num,0> { static const bool isOdd = false; }; template <int num> struct Num<num,1> { static const bool isOdd = true; }; //in main cout << "45 is odd: " << Num<45>::isOdd;