Hey guys I'm wondering how I could convert this to one that computes 3^n - 2^n....that is 3 to the power n minus 2 to the power n.
Code:#include<iostream> using namespace std; template <int n> struct Fac // general case n! = n*(n-1)! { enum { result = 3 ^ n - 2 ^ n }; // constant }; //template <> struct Fac<0> // base case 0! = 1 //{ ///enum { result = 1 }; // constant //}; int main() { // Fac<c>::result is now a compile-time constant! cout << Fac<5>::result << endl; cout << Fac<10>::result << endl; cout << Fac<0>::result << endl; }