title: recursive function digits of a positive decimal integer in reverse order c++
body: <p>I have an assignment to write a recursive function that writes the digits of a positive integer in reverse order. My problem is that the function doesn't display the reverse correctly. I know im supposed to use % or 10 when displaying the number and / of 10 when in the recursive call as well as the base case is supposed to be &lt; 10. Here is my code.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int reverse(int,int);
  
  int main()
  {
      int number;
      int n;
  
      cout &lt;&lt; " Enter number to reverse." &lt;&lt; endl;
      cin &gt;&gt; number;
      cout &lt;&lt; reverse(number % 10,0);
  
      return 0;
  }//end main
  
  int reverse(int number,int n)
  {
  
      if(n &lt; 10)
      {
          return n;
      }
      else
      {
          return reverse(number/10,n);
      }
  }// end reverse
  </code></pre>