[ create a new paste ] login | about

Link: http://codepad.org/yoVMNlXH    [ raw code | output | fork ]

nilukush - C++, pasted on May 19:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>

template<int N>
class Pow3
{       public:
                enum { result = 3 * Pow3<N - 1>::result };
};

template<>
class Pow3<0>
{       public:
                enum { result = 1 };
};

int main()
{       std::cout << Pow3<7>::result;
        return 0;
}


Output:
1
2187


Create a new paste based on this one


Comments: