Junior — Middle+
Recursive factorial calculator using C++ templates
livecode
Task condition
Complete the provided template code so that it correctly calculates the factorial of a number during compilation.
# include <iostream>
template<int n>
struct F {
enum { value = n * F<n - 1>::value };
};
int main() {
std::cout << F<5>::value << '\n';
}