title: How can I convert a basic nested loop to recursive in C++
body: <p>I'm learning recursion and I am looking for a simple example of how to convert this basic nested loop to a recursive function. Thanks for your input:
  EDIT: I provided my failed attempt to convert the nested loop. I can't yet envision the recursive process, but my research has shown this is the recursive format. It will not display output ,as I'm not sure where to place the cout line.</p>
  
  <p><em>The Nested loop:</em></p>
  
  <pre><code>#include "stdafx.h"
  #include&lt;string&gt;
  #include&lt;fstream&gt;
  #include&lt;iomanip&gt;
  #include&lt;vector&gt;
  #include&lt;iostream&gt;
  #include&lt;string.h&gt;
  
  
  using namespace std;
  
  void recursive(int x, int y)
  {
      for (int i = x; i &gt; 0; i--)
          for (int j = y; j &gt; 0; j--)
          {
              cout &lt;&lt; i &lt;&lt; " , " &lt;&lt; j &lt;&lt; endl;
          }
  }
  int main()
  {
      int x, y;
      cout &lt;&lt; "Enter 2 numbers:\n";
      cin &gt;&gt; x &gt;&gt; y;
      recursive(x, y);
      return 0;
  }
  </code></pre>
  
  <p>My attempt to convert to a recursive function:</p>
  
  <pre><code>void recursive(int start, int N)
  {
  
      for (int x = start; x &lt; N; x++)
      {
  
          recursive(x + 1, N);
  
      }
  
  
  
      for (int y = start; y &lt; N; y++)
      {
  
          recursive(y + 1, N);
  
      }
  }
  
  int Main()
  {
      recursive(0,3);
      return 0;
  }
  </code></pre>