title: Why won't my program output i?
body: <p>My program is supposed to find the factorial of a number by creating a function, and display the results in a table format. In the main body of my program I have a <code>cout</code> for <code>i</code>, and my function <code>factNum i</code>, but only <code>factNum i</code> is being output? How do I make it so that both <code>i</code> and <code>factNum i</code> are displayed next to each other? And also, how do I fix my for loop so that it will continue to ask the user for numbers after the first run through?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  using namespace std;
  
  
  int factNum ( int num)
  {
    int answer = 1;
  
    for (int i = 1; i &lt;= num; i++)
    {
        answer = answer * i;
    }
    return answer;
  }
  
  int main()
  {
    int num;
  
    cout &lt;&lt; " Enter a number, or -1 to quit: " &lt;&lt; endl;
    cin&gt;&gt; num;
  
    for (int i= 1; i&lt;=num; i++){
      cout&lt;&lt; i &lt;&lt; factNum(i)&lt;&lt; endl;
    }
  
    if( num == -1)
      cout&lt;&lt; " Goodbye! "&lt;&lt; endl;
  
     return 0;
  }
  </code></pre>