Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- template <int n>
- struct Factorial {
- static int Value() {
- return Factorial<n - 1>::Value() * n;
- }
- };
- template<>
- struct Factorial<1> {
- static int Value() {
- return 1;
- }
- };
- int main() {
- std::cout << Factorial<3>::Value() << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement