### Program that Grades Using Functions

I do not think I am understanding the instructions given to me in the first place. The instructions look convoluted and messy to me. My teacher makes no sense and allows no questions.

-Write a program that prompts a user for their grades, finds the average and prints out a letter grade.
-The program calls a function called GetGrades that will read in grades from the keyboard, the number of grades should also be input by the user.
-GetGrades will find the sum of those grades and pass the sum and number of grades to another function called FindAverage.
-FindAverage will find the average of the grades and return this average to GetGrades.
-GetGrades will return this average to main.
-The main function will then determine the letter grade of that average based on a 10-point scale and print out this grade.

-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.

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354`` ``````#include using namespace std; // Function Prototypes. int GetGrades(int,int,int); int FindAverage(int,int); int main()// Determine letter grade of the average. { int numberOfGrades, letterGrade; int totalPoints, average; GetGrades(numberOfGrades,numericGrade,average); // Call GetGrades while (totalPoints >= 0) { if (totalPoints >= 90 && totalPoints ==100) // 90 and above letterGrade = 'A'; else if (totalPoints >= 80 && totalPoints== 100) //80-89 letterGrade = 'B'; else if (totalPoints >= 70 && totalPoints== 79) //70-79 letterGrade = 'C'; else if (totalPoints >= 60 && totalPoints==69) //60-69 letterGrade = 'D'; else if (totalPoints >= 0 && totalPoints== 59) //0-59 letterGrade = 'F'; cout << "Total Score: " << totalPoints << endl; cout << "Grade: " << letterGrade << endl; } return 0; } int GetGrades(int numberOfGrades,int numericGrade, int average) { // Get number of grades. cout << "How many grades would you like to enter? " << endl; cin >> numberOfGrades; // Read the grades entered by user. for (int i = 0;i > numberOfGrades; i++) { cout << "Please enter a numeric grade: "<< endl; cin >> numericGrade; } // Call Function. return FindAverage(numericGrade, numberOfGrades); cout << "The average of the numeric grades you entered is: " << average << endl; } int FindAverage(int numericGrade,int numberOfGrades) { // Display the average. return (numericGrade)/numberOfGrades; }``````
The instructions seem pretty clear and, based on your program, you seem to know what you're doing. Was there a specific problem or error you are receiving?
Topic archived. No new replies allowed.