Challenge of the day " C++"
What will this program output ?
C++
#include <iostream>
template<int N>
struct Fibonacci {
static const int value = Fibonacci<N - 1>::value + Fibonacci<N - 2>::value;
};
template<>
struct Fibonacci<0> {
static const int value = 0;
};
template<>
struct Fibonacci<1> {
static const int value = 1;
};
int main() {
std::cout << Fibonacci<6>::value;
return 0;
}C++
#include <iostream>
template<int N>
struct Fibonacci {
static const int value = Fibonacci<N - 1>::value + Fibonacci<N - 2>::value;
};
template<>
struct Fibonacci<0> {
static const int value = 0;
};
template<>
struct Fibonacci<1> {
static const int value = 1;
};
int main() {
std::cout << Fibonacci<6>::value;
return 0;
}