Need help with the GPA calculator...

For instance, grade scale is: A=4.0, B=3.0, C=2.0, D=1.0, F=0;

and you have three classes need to add up and calculate the GPA, which the grades are: one, two, three;

equivalent credits for each grade is: oneC, twoC, threeC;

formula is: grade * equivalent credit = weighted grade
(sum of all weighted grades)/(sum of all credits) = GPA

so it's like (one*oneC + two*twoC + three*threeC)/(oneC+twoC+threeC)=GPA


So, here is my question; i just need to cin 3 times, which are any among (a,b,c,d,f), then get the GPA cout. What is the most effective and simple way to do it ?
You could use a do while loop where the condition ensures a proper grade input and a counter.

1
2
3
4
5
6
7
8
do {
        cout >> "Enter a grade\n";
        cin >> grade;
        if (ValidGrade(grade)) 
             count++;              
             
}
while (count < 3);
the grades i got from input are transforming to ASCII values, anyone know why ? newb here
no one has any opinion ?
Topic archived. No new replies allowed.