title: adding a newline to file in C++
body: <p>Can any body help me with this simple thing in file handling?</p>
  
  <p>The following is my code:</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;fstream&gt;
  using namespace std;
  int main()
  {
    ofstream savefile("anish.txt");
   savefile&lt;&lt;"hi this is first program i writer" &lt;&lt;"\n this is an experiment";
   savefile.close();
    return 0 ;
   }
  </code></pre>
  
  <p>It is running successfully now, I want to format the output of the text file according to my way.</p>
  
  <p>I have: </p>
  
  <blockquote>
    <blockquote>
      <p>hi this is first program i writer this is an experiment</p>
    </blockquote>
  </blockquote>
  
  <p>How can I make my output file look like the following:</p>
  
  <blockquote>
    <blockquote>
      <p>hi this is first program </p>
      
      <p>I writer this is an experiment </p>
    </blockquote>
  </blockquote>
  
  <p>What should I do to format the output in that way ?</p>