Hi all, need some suggestions. This code looks like a jumbled mess to me. I am missing something and am not sure what.
-Main should determain the letter grade of an average based on a 10-point scale and print out this grade.
90–100 A
80–89 B
70–79 C
60–69 D
0–59 F
-GetGrades function should get number of grades, read the grades entered, find the sum of those grades and pass the sum and number to FindAverage.
-FindAverage will get the average of the grades and return the average to GetGrades.
-GetGrades will return this average to main.
#include <iostream>
using namespace std;
// Function Prototypes.
void GetGrades(int,int);
void FindAverage(int,int);
int main()// Determine letter grade of the average.
{
int score;
int totalPoints;
int average;
int num;
int grade;
GetGrades(score,grade);
while (score >= 0)
{
totalPoints += score; // Accumulate the running total.
if (totalPoints >= 90) // 90 and above
grade = 'A';
else if (totalPoints >= 80) //80-89
grade = 'B';
else if (totalPoints >= 70) //70-79
grade = 'C';
else if (totalPoints >= 60) //60-69
grade = 'D';
else if (totalPoints >= 0)
grade = 'F';
cout << "Total Score: " << totalPoints << endl;
total = FindAverage(average,num);
cout << "Grade: " << grade << endl;
}
return 0;
}
void GetGrades(int num,int grade)
{
cout << "How many grades would you like to enter? ";
cin >> num;
while (num >> 0)
{
cout << "Please enter a numeric grade: ";
cin >> grade;
// Call Function.
total = FindAverage(average, num)
// Display Answer.
cout << "Your grade average is: ";
}
}
void FindAverage(int average,int totalPoints,int num)
{
// Display the average.
average = (totalPoints)/num;
cout << "The average of the numeric grades you entered is: " << average << endl;
}