File Processing

I have to have three files
a. Masterfile - contains customer name, Acct number and balance
b. Transaction file -processes monetary transactions made by a client
c. PrintInvoice file - this file takes the transactions made by a single client and output them under the clients name and Acct Number

I have processed the Masterfile and the Transaction file however I am having problems with the Print invoice file. Apparently when I run the program it just output data from the transaction file for the first client in the master file. My code for the Print Invoice file is below

#include
#include


int main ()
{

int t_account_no, m_account_no, t_TransacCode;
char t_PayType, m_FName[30], m_LName[30], t_ItemOrder[30];
double t_amount, m_balance, new_balance=0.00;


fstream master("a:master.txt", ios::in);//opens master file for reading
fstream transac("a:Transac.txt", ios::in);//opens transaction file for reading

while (!transac.eof()) {

while(master>>m_account_no>>m_FName>>m_LName>>m_balance)
{ cout<<m_account_no<<' '<<m_FName<<' '
<<m_LName<<' '<<m_balance<<endl; while transac>>t_account_no>>t_PayType>>t_TransacCode
>>t_ItemOrder>>t_amount)
{
if(m_account_no == t_account_no)
{
cout<<t_PayType<<' '<<t_TransacCode<<' '
<<t_ItemOrder<<' '<<t_amount<<endl;
}
}
cout<<endl;
}
}



return 0;
}
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories