title: Using C++ Fstream to output numbers from text file - Need help separating lines
body: <p>I need to create a program that takes integers from a text file, and outputs them, including the number, lowest number, largest number, average, total, N amount of numbers, etc. I can do this just fine with the code below, but I also need to process the text per line. My sample file has 7 numbers delimited with tabs per row, with a total of 8 rows, but I am to assume that I do not know how many numbers per row, rows per file, etc. there are.</p>
  
  <p>Also, for what it's worth, even though I know how to use vectors and arrays, the particular class that I'm in has not gotten to them, so I'd rather not use them.</p>
  
  <p>Thanks.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main() {
      int num;
      int count = 0;
      int total = 0;
      int average = 0;
      string str = "";
      int numLines = 0;
      int lowNum = 1000000;
      int highNum = -1000000;
  
      ifstream fileIn;
  
      fileIn.open("File2.txt");
  
      if (!fileIn) {
          cout &lt;&lt; "nError opening file...Closing program.n";
          fileIn.close();
      }
      else {
          while (!fileIn.eof()) {
              fileIn &gt;&gt; num;
              cout &lt;&lt; num &lt;&lt; " ";
              total += num;
              count++;
  
              if (num &lt; lowNum) {
                  lowNum = num;
              }
  
              if (num &gt; highNum) {
                  highNum = num;
              }
          }
  
          average = total / count;
  
          cout &lt;&lt; "nnTotal is " &lt;&lt; total &lt;&lt; "." &lt;&lt; endl;
          cout &lt;&lt; "Total amount of numbers is " &lt;&lt; count &lt;&lt; "." &lt;&lt; endl;
          cout &lt;&lt; "Average is " &lt;&lt; average &lt;&lt; "." &lt;&lt; endl;
          cout &lt;&lt; "Lowest number is " &lt;&lt; lowNum &lt;&lt; endl;
          cout &lt;&lt; "Highest number is " &lt;&lt; highNum &lt;&lt; endl;
  
          fileIn.close();
  
          return 0;
      }
  }
  </code></pre>