In [1]:
#include <iostream>
using namespace std;
In [2]:
template <int N> struct Fakultaet{
static int const value= N * Fakultaet<N-1>::value;
};
In [3]:
template <> struct Fakultaet<1>{
static int const value = 1;
};
In [4]:
int main(void)
{
cout << Fakultaet<5>::value << endl;
return 0;
}
In [ ]: