// recursiveFactorialFred.cc P. Conrad 09/23/05
// compute factorial with recursion

// This shows that there is nothing sacred
// about using #ifdef DEBUG vs. #ifdef FRED

// however, using #ifdef FRED would be very
// silly, and very questionable style

#include <iostream>
using namespace std;


int factorial(int x)
{
  // recursive factorial

  if (x == 0)
    {
#ifdef FRED
      cout << "I'm in the if x==0 part"  << endl;
#endif
      return 1;
    }
  else
    {
#ifdef FRED
      cout << "I'm in the else part, x = " << x << endl;
#endif
      return x * factorial(x-1); 
    }
}

int main(void)
{
  int x;

  cout << "Enter x: ";
  cin >> x;

  cout << "x! is : " << factorial(x) << endl;

  return 0;

}

