Hey all I have a program that I have been working on and am having some trouble with keeping count of all the users grades. I know that now I am only counting the last grade earned for each category but I want to know how to keep count of all of them so my calculations are correct. I'm hoping someone could point me in the right direction.

``````#include <iostream>
#include <iomanip>
using namespace std;

{

for (int x = 1; x <= 18; x++)
{
cout << " Enter BASAL grade #" << x << " (out of 100):";
}

double total;
total = ((grade * 5) / 100);
cout << "Basal points: " << total << endl;

}

{
for (int x = 1; x <= 12; x++)
{
cout << " Enter APES grade #" << x << " (out of 100):";
}
double total2;
total2 = (((grade2 * 10) / 100) * 12);
cout << "Apes points: " << total2 << endl;

}
{
for (int x = 1; x <= 8; x++)
{
cout << " Enter quiz grade #" << x << " (out of 100):";
}
double total3;
total3 = (((grade3 * 10) / 100) * 8);
cout << "Quiz points: " << total3 << endl;

}
{
cout << "How many mini problems have you solved? ";
double total4;
cout << "Mini-problems points: " << total4 << endl;

}
{

if (percentage >= 95)
{
cout << "You got an A" << endl;
}
else if (percentage >= 90 && percentage < 95)
{
cout << "You got a A-" << endl;
}
else if (percentage >=85 && percentage < 90)
{
cout << "You got a B" << endl;
}
else if (percentage >= 80 && percentage < 85)
{
cout << "You got a B-" << endl;
}
else if (percentage >= 75 && percentage < 80)
{
cout << "You got a C" << endl;
}
else if (percentage >= 70 && percentage < 75)
{
cout << "You got a C-" << endl;
}
else if (percentage >= 65 && percentage < 70)
{
cout << "You got a D" << endl;
}
else if (percentage >= 60 && percentage < 65)
{
cout << "You got a D-" << endl;
}
else
{
cout << "You got a F" << endl;
}
return percentage;
}

int main()
{

cout << "Enter final exam grade (or a guess) (out of 100): ";
cout << "Total points: " << grandTotal << endl;
percentage = ((grandTotal / 465) * 100);
cout << "Percentage score: " << setiosflags(ios::fixed) << setprecision(4) << percentage << endl;

}``````

``````double calcBasal (double grade)
{

for (int x = 1; x <= 18; x++)
{
cout << " Enter BASAL grade #" << x << " (out of 100):";
cin >> grade;         // read 18 numbers and keep only the last one
}

double total;
total = ((grade * 5) / 100); // multiply this one grade by .05
cout << "Basal points: " << total << endl;

Now if you read my comments and think about them, you should have an "aha!" moment. `total += grade * 5 / 100` is kinda correct, but you need to do part of this statement in a different place.