while loop college tuition

so I'm fairly new to C++ and I'm working this program to calculate the total of an individual students college tuition. I have to use a while loop, and at the end i have to calculate the total dues of all the students combined, how many are valid and invalid. it should look something like this
Student #: 101
Initials: AB
Residency status: resident
Credits: 14
Tuition: $ 1820.00
Total due: $ 1820.00

Student #: 202
Initials: DC
Residency status: non-resident
Credits: 8
Tuition: $ 8480.00
Housing: $ 3500.00
Meals: $ 2000.00
Total due: $ 13980.00

Student #: 404
Initials: XY
Sorry your request for 25 credits is invalid

FINAL TOTALS
Valid request count: 2
Invalid request count: 1
Total fees due: $ 15800.00

I have almost everything done. I just dont know what i would to display the valid and invalid request counts.
Last edited on
I don't know quite what your code looks like, but I assume you use if statements to determine whether a tuition is valid or not. So in your if statement just keep a counter that increments each time it is used.

1
2
3
4
5
6
7
8
9
10

int valid = 0;
int invalid = 0;

if( valid tuition ){
//+= tuition to whatever your variable is 
valid++;
}else
invalid++;

Topic archived. No new replies allowed.