Advertisement
kalabukdima

Fibonacci C++98

Dec 10th, 2020
854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <memory>
  3. #include <vector>
  4.  
  5. template <int N>
  6. struct Fib {
  7.     static int const value = Fib<N - 1>::value + Fib<N - 2>::value;
  8. };
  9.  
  10. template <>
  11. struct Fib<0> {
  12.     static int const value = 1;
  13. };
  14.  
  15. template <>
  16. struct Fib<1> {
  17.     static int const value = 1;
  18. };
  19.  
  20. template <int>
  21. struct TD;
  22.  
  23. int main() {
  24.     TD<Fib<10>::value> t;
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement