ok guys one quick question for you. If im reading a file say formated like so..
123 d52.55 w52.66 d55.55 d66.66
456 w55.55 d55.55 d66.6
and i want to read the first variable so 123 and match it up with another file. how do i go about reading the rest of the line without running into the next line. I want to devide up each part ie. d is for deposit and then amount and for the account number 123. I have a program that runs but it assigns all withdrawl and deposits for 123 so it skips over 456 and dosnt read it.
int fillArrayT( PersonAcct customerArray[7], ifstream& inFileT)
{
char tranType = 'w';
float amount;
int accountno;
int i=0;
customerArray[i].withdrawl = 0;
customerArray[i].deposit = 0;
while(!inFileT.eof())
{
cout << " outer while loop" << endl; // testing purpose
inFileT >> accountno;
for ( i = 0 ; i< 6 ; i++)
if ( accountno == customerArray[i].acct_num )
{
cout << " TESTING" << endl; // testing purpose
while(inFileT >> tranType >> amount)
{
cout << " money" << endl; // testing purpose
switch(tranType)
{
case 'd': // deposit
customerArray[i].deposit = customerArray[i].deposit + amount;
customerArray[i].timesD = 0;
customerArray[i].timesD +=1;
cout << "value d" << amount ; // testing purpose
break;
case 'w': // withdrawal
customerArray[i].withdrawl = customerArray[i].withdrawl - amount;
customerArray[i].timesW = 0;
customerArray[i].timesW +=1;
cout << " value w"<< amount; // tesing purpose
break;
}
}
}
}