title: recursive function that returns factorial C++
body: <p>I am trying to solve at the following exercise from the C++ Primer Plus book.</p>
  
  <blockquote>
    <p>Define a recursive function that takes an integer argument and returns
    the factorial of that argument. Recall that 3 factorial, written 3!,
    equals 3 × 2!, and so on, with 0! defined as 1. In general, if n is
    greater than zero, n! = n * (n - 1)!. Test your function in a program
    that uses a loop to allow the user to enter various values for which
    the program reports the factorial.</p>
  </blockquote>
  
  <p>I wrote the code that goes into main().</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int factorial(int n);
  
  
  int main()
  {
      int number= 0;
      cout&lt;&lt;"Enter a number(0 to quit): ";
      while (cin &gt;&gt; number &amp;&amp; number! = 0)
      {
          cout&lt;&lt; "Here is the factorial of the number: "&lt;&lt; factorial (number) &lt;&lt; ". \n"
          "Enter next number(0 to quit): ";
      }
  
  
      return 0;
  }
  </code></pre>
  
  <p>Now I can't think of a proper recursive function declaration. Can someone help  by writing the easiest (for someone new in programming) to grasp function declaration for this exercise? </p>