title: How to use fstream in c++ in this situation?
body: <pre><code> #include&lt;iostream&gt;
  
  using namespace std;
  
  int main () 
  
  {
  
      int x;
      cout &lt;&lt; "Pls. enter a natural number" &lt;&lt; "\n" ;
      cin &gt;&gt; x ;
       cout  &lt;&lt; "\n" ;
      for (int i=1 ; i&lt;=x ; i++ )
      {
          x = x-1;
          cout &lt;&lt; i &lt;&lt; " " &lt;&lt; x &lt;&lt; "\n" ;
      }
      cout  &lt;&lt; "\n" ;
      system ("pause");
      return 0;
  } $
  </code></pre>
  
  <p>I have this sample code with cin first then cout.. my problem is that instead of the cout to output in the cmd it will be sent to a .txt file.. Where will I include the fstream codes.. thanks a lot...</p>