user6807078 user6807078 - 3 months ago 7
C++ Question

How can I loop my output so that all the results in my text file show?

EDIT: solved now

So I'm trying to complete a program and I'm pretty sure I'm almost done but I'm missing something I just don't know what it is.

Anyways here's the assignment.


A bank charges $10 per month plus the following check fees for a
commercial checking account:

$0.10 each for fewer than 20 checks $0.08 each for 20-39 checks $0.06
each for 40-59 checks $0.04 each for 60 or more checks The bank also
charges an extra $15.00 if the balance of the account falls below $400
(before any check fees are applied). Write a program named lab2 that
inputs for the beginning balance and the number of check written from
the transaction file. Compute and display the bank's service fees for
the month.

Answer
for (transaction = 0; transaction <=5; transaction++)

Your for loop is a single line with no {}. This results in only the first statement after the loop begin considered as within the loop. Also, put the input statements within the loop.

Replace it with:

for (transaction = 0; transaction <=5; transaction++){
   inputFile >> acctBalance;
   inputFile >> numChecks;
   inputFile >> transaction;
   //All your if else statements here

}
return 0;