Trouble initializing a variable
<p>below is a code I am writing to learn about using files in C++. I have everything reading and writing correctly but I can not get my display to show the correct values because it is ignoring when I try to initialize the Total variables in the while loop. </p>

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

int main()
{
    int customerNumber;
    double beginningBalance, purchase, payments, financeCharge, endingBalance;
    double beginningTotal, purchaseTotal, paymentsTotal, financeChargeTotal, endingTotal;
    ifstream inputFile;
    ofstream outputFile;

    inputFile.open("BeginningBalance.dat");
    outputFile.open("EndingBalance.dat");
    cout&lt;&lt;"Cust No | Beginning Bal | Finance Charge | Purchases | Payments | Ending Balance"&lt;&lt;endl;

    while (inputFile &gt;&gt; customerNumber)
    {
        outputFile &lt;&lt;customerNumber&lt;&lt;endl;
        inputFile &gt;&gt; beginningBalance;
        inputFile &gt;&gt; purchase;
        inputFile &gt;&gt; payments;

        financeCharge = beginningBalance * .01;
        endingBlanance= beginningBalance + purchase + financeCharge - payments;

        //***********************************************
        //This is where I am having trouble initializing variables.
        //***********************************************
        beginningTotal += beginningBalance; //beginningTotal not being intitialized.
        financeChargeTotal += financeCharge;
        purchaseTotal += purchase;
        paymentsTotal += payments;
        endingTotal += endingBalance;

        outputFile &lt;&lt;fixed&lt;&lt;setprecision(2)&lt;&lt;endingBalance&lt;&lt;endl;

        cout&lt;&lt;setw(5)&lt;&lt;customerNumber&lt;&lt;fixed&lt;&lt;setprecision(2)&lt;&lt;"        "&lt;&lt;beginningBalance&lt;&lt;"        "&lt;&lt;financeCharge&lt;&lt;"          "&lt;&lt;purchase&lt;&lt;"       "&lt;&lt;payments&lt;&lt;"       "&lt;&lt;endingBalance&lt;&lt;endl;
    }
    cout&lt;&lt;"Total:    "&lt;&lt;fixed&lt;&lt;setprecesion(2)&lt;&lt;beginningTotal&lt;&lt;"   "&lt;&lt;financeChargeTotal;
    system ("PAUSE");
    return 0;
}
</code></pre>
