c++ my counter adds an extra count 
<p>I am new to programming and trying to teach myself but my counter is displaying one more than it should. it should be displaying 22, but it is displaying 23.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
#include &lt;iomanip&gt;
using namespace std;

//Main and variable data type initializing

void main()
{    float c,l,x,y,z;
    int count;
    string input, output;
    string finput, foutput;
    fstream i,o;    //i = input file;    o = output file;
//Getting the name of the files

    cout &lt;&lt; "XZY Multiply Program\n" &lt;&lt; endl;
    cout &lt;&lt; "Enter the input file name:  c:/";
    cin &gt;&gt; input;
    cout &lt;&lt; "Enter the output file name:  c:/";
    cin &gt;&gt; output;

//inserts the beginning of the file and file extension.

    finput = "c:/" + input;
    foutput = "c:/" + output;

//Opens files

    i.open(finput.data(),ios::in);
    o.open(foutput.data(),ios::out);

//Initialize count and sum of variables

    count = 0;
    x=0;
    y=0;
    z=0;

//loop through input file

    while(!i.eof() &amp;&amp; !o.eof())
    {   count++;
        if (i.good() &amp;&amp; o.good())
        {

                i &gt;&gt; c;
                i &gt;&gt; l;   
                o &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; setprecision(4);
                o &lt;&lt; setw(7) &lt;&lt; c;
                o &lt;&lt; setprecision(2);
                o &lt;&lt; setw(9) &lt;&lt; l;
                o &lt;&lt; setprecision(3);
                o &lt;&lt; setw(10) &lt;&lt; (l*c) &lt;&lt; endl;

// Adds columns
                x = x+c;
                y = y+l;
               z = z+(l*c);

        } 
         else
        {
        cout &lt;&lt; "no good";
        }

    }
     i.close();
     o.close();



    //Display the output of the counter and Sums of columns
            cout &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; setprecision(2);
            cout &lt;&lt; "\n" &lt;&lt; count &lt;&lt; " lines in file " &lt;&lt; endl;
            cout &lt;&lt; "X sum = " &lt;&lt; setw(8) &lt;&lt; right &lt;&lt; x &lt;&lt; endl;
            cout &lt;&lt; "Y sum = " &lt;&lt; setw(8) &lt;&lt; right &lt;&lt; y &lt;&lt; endl;
            cout &lt;&lt; "Z sum = " &lt;&lt; setw(8) &lt;&lt; right &lt;&lt; z &lt;&lt; endl;


}

  7.2830     84.40
  9.1327    124.02
  7.2619    133.16
  6.2527     43.96
  4.2160     24.08
  5.2724     57.80
  5.2025     73.89
 -9.9500     80.53
  0.2790    -12.43
  2.2115      3.37
  3.1222     13.63
 16.2413    223.01
 -4.2026     33.78
 -7.1914     42.89
  4.1417     53.42
  6.1714     61.66
  9.2516     73.68
 15.2419    383.66
  6.2715     93.53
 -3.2016      3.46
 12.2013    213.63
  3.1824     23.85
</code></pre>
