Originally posted by cuttlefishkarl
3578 0.03 904.67 3 0.00 50.00 0.00 0.00 75.00 0.00
the first number is the account number
the second number is the interest rate
the third number is the balance
the fourth number is how many months the account has been open
the fifth, seventh, and ninth are deposits
the sixth, eight and tenth numbers are withdrawals
If every line always has 10 numbers with above description it's easy to read those numbers
Code:
while inFile
read account
read interest
read balance
read open
read deposit1
read deposit2
read deposit3
read withdrawal1
read withdrawal2
read withdrawal3
calculate total deposit etc
print to file
However, if number of deposits/withdrawals varies one line to another, it's impossible to read it without modification on the input file