title: Writing .csv files from C++
body: <p>I'm trying to output some data to a .csv file and it is outputting it to the file but it isn't separating the data into different columns and seems to be outputting the data incorrectly. </p>
  
  <pre><code>    ofstream Morison_File ("linear_wave_loading.csv");         //Opening file to print info to
      Morison_File &lt;&lt; "Time Force(N/m)" &lt;&lt; endl;          //Headings for file
      for (t = 0; t &lt;= 20; t++) {
        u = sin(omega * t);
        du = cos(omega * t); 
        F = (0.5 * rho * C_d * D * u * fabs(u)) + rho * Area * C_m * du; 
  
        cout &lt;&lt; "t = " &lt;&lt; t &lt;&lt; "\t\tF = " &lt;&lt; F &lt;&lt; endl;
        Morison_File &lt;&lt; t;                                 //Printing to file
        Morison_File &lt;&lt; F;
  
      }
  
       Morison_File.close();
  </code></pre>
  
  <p>Time and Force(N/m) are in columns A and B respectively but the t and F values are both printing the first row. </p>
  
  <p>What is the syntax to separate them to print t into column A and F into column B?</p>