Guest User

Untitled

a guest
Oct 21st, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1.  
  2. template<int n> struct fac
  3. {
  4. enum { value = n * fac<n-1>::value };
  5. };
  6.  
  7. template<> struct fac<0>
  8. {
  9. enum { value = 1 };
  10. };
  11.  
  12. template<int n> struct fib
  13. {
  14. enum { value = fib<n-1>::value + fib<n-2>::value };
  15. };
  16.  
  17. template<> struct fib<1>
  18. {
  19. enum { value = 1 };
  20. };
  21.  
  22. template<> struct fib<0>
  23. {
  24. enum { value = 1 };
  25. };
Add Comment
Please, Sign In to add comment