title: Is there a way in C++ to start a new line with streams and output files?
body: <p>I am writing a program that computes wind chill from temperatures from an input file, asking the user for the speed of the wind, and then computing the wind chill, displaying it on the monitor, and writing the data in a text file named FileB.txt. Is there a way to have spaces or even lines in between the values that are computed? Right now I do achieve the correct answer, however, the numbers are displayed running into each other with no spaces. I tried the endl function but it doesn't appear to be working. In addition, it's not writing the value to the file named FileB.txt, but I think I've been looking at this program for far too long. If anyone notices where I go wrong or has any pointers or resources I could use to learn more about this concept, it would be much appreciated.</p>
  <pre><code>enter code here
  
  
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  #include &lt;iostream&gt;
  #include &lt;fstream&gt; // Step (1)
  #include &lt;cmath&gt;
  
  using namespace std;
  
  int main()
  {
      int wind;
      cout &lt;&lt; &quot;Enter the speed of the wind in miles per hour, then press &lt;Enter&gt; \n&quot;;
      cin &gt;&gt; wind;
      char input_file[31]; // Step (2)-A
      char output_file[31];
      ifstream in_s;
      ofstream out_s;
      in_s.open(&quot;FileA.txt&quot;);
      if (in_s.fail())
      {
          cout &lt;&lt; &quot;Input file opening failed!\n&quot;;
          exit(1);
      }
      out_s.open(&quot;FileB.txt&quot;);
      if (out_s.fail())
      {
          cout &lt;&lt; &quot;Output file opening failed!\n&quot;;
          exit(1);
      }
      int num;
      double windC;
      in_s &gt;&gt; num;
      while (!in_s.eof()) { // keep reading until end-of-file
          windC = 0.0817 * (3.71 * sqrt(wind) + 5.81 - 0.25 * sqrt(wind)) * (num - 91.4) + 91.4;
          
          cout &lt;&lt; windC &lt;&lt; endl;
              out_s &lt;&lt; windC;
          
          in_s &gt;&gt; num; // sets EOF flag if no value found
      }
  
      in_s.close();
      out_s.close();
      return 0;
  
  }
  </code></pre>