Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Normal
You can use template metaprogramming to speed up the computation of factorials. This is advanced C++, though. C++ Template Metaprogramming has an example. If you are programming a more conventional factorial function, don't recurse or your stack may overflow. Use a loop. And make sure you don't overflow the int bounds and wind up with a garbage value. n! gets very large very quickly.
You can use template metaprogramming to speed up the computation of factorials. This is advanced C++, though.
C++ Template Metaprogramming has an example.
If you are programming a more conventional factorial function, don't recurse or your stack may overflow. Use a loop. And make sure you don't overflow the int bounds and wind up with a garbage value. n! gets very large very quickly.