17 lines
217 B
C++
17 lines
217 B
C++
#include <iostream>
|
|
|
|
template<int N>
|
|
struct Fact {
|
|
enum {RET = N * Fact<N-1>::RET};
|
|
};
|
|
|
|
template<>
|
|
struct Fact<0>{
|
|
enum {RET = 1};
|
|
};
|
|
|
|
int main() {
|
|
std::cout << Fact<5>::RET << std::endl;
|
|
return 0;
|
|
}
|