chinkums 0 Newbie Poster

I am trying to read a file and display data. The data is bank transactions. I need to display the data from the file with a balance column added at the end keeping an accumulated balance of the deposits/transactions. I am having difficulties with the accumulator.

Additionally it will need to display an NSF when the balance goes below 0. I haven't focused terribly on that and plan to do so once I get the balance accumulator working.

Any help understanding what I am doing wrong would be greatly appreciated!!!

The data file:

02/03/2012 Initial_Deposit         2000
02/04/2012 Swinn_Super_Deluxe      -660
02/06/2012 Swinn_Starlet           -420
02/07/2012 Walmart_Slim            -325
02/10/2012 Swinn_Tabgo_Tandem      -770
02/11/2012 Suwanee_Tango_Tandem    -660
02/13/2012 Deposit                 5000
02/15/2012 Suwanee_Creek_11_Trek   -730
02/20/2012 Cycles_ATL_12_Trek_Cpk  -1210
02/23/2012 Cycles_ATL_11_Trek      -1250
02/24/2012 Kmart_Special           -250
02/25/2012 Deposit                 4000

mm/dd/yyyy


Code:

// BicycleSales.cpp 

#include "stdafx.h"
#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;

// Protoypes
void initialization(void);	
void process(void);			
void eoj(void);				
void readIt(void);			
void writeIt(void);

// Global Variables
ifstream inputFile;
char date[11];
char transaction[24];
float nsfFee = -15.00;
float transactionAmount;
float balance =+ transactionAmount;
bool b_eof;

// Main
int main()
{
	initialization();

	while (b_eof==false)
	{
		process();
	}
	//process();
	eoj();
	return 0;
}

void initialization(void)
{
	inputFile.open("f:\\transactions.dat"); 
	cout << " DATE                TRANSACTION      AMT   BAL   " << endl;
	readIt();
}
void process(void)
{
	writeIt();	
	readIt();	
}
void eoj(void)
{
	inputFile.close();
}

void readIt(void)
{
	inputFile >> date >> transaction >> transactionAmount;
}

void writeIt(void)
{
	//float balance =+ transactionAmount;
	while (inputFile >> date >> transaction >> transactionAmount)
	{
	cout << setw(11) << date << setw(24) << transaction << setw(6) << transactionAmount << setw(6) << balance << endl;
		if (balance<0.00)
		{
			cout << setw(11) << date << setw(24) << "NSF FEE" << setw(6) << nsfFee << setw(6) << balance + nsfFee << endl;
		}
	}
}

/*void accumulate(void)
{
	if (balance<0.00)
	{
		cout << setw(11) << date << setw(24) << "NSF FEE" << setw(6) << nsfFee << setw(6) << balance + nsfFee << endl;
	}
}*/