Hi im having a hard time on where to go from here or if im already doing something wrong. I posted my prompt on the bottom.
getGrades()
Write a function to prompt the user for ten grades and return the result back to main(). Note that any variables declared in getGrades() will be destroyed when the function returns. This means that main() will need to declare the array and pass it as a parameter to getGrades().
averageGrades()
Write another function to find the average of the grades and return the answer. Of course, the grades array will need to be passed as a parameter. The return value should be the average.
main()
Finally, create main() that does the following:
◾Has the grades array as a local variable
◾Calls getGrades()
◾Calls averageGrades()
◾Displays the result
#include <iostream>
usingnamespace std;
/******************************************************************
* This function will get the Grades!!
****************************************************************/
int getGrades() {
constint SIZE = 10;
int Grades[SIZE];
float average;
for (int i = 0; i < SIZE; i++)
// Fill the list
{
cout << "Grade " << i + 1 << ": ";
cin >> Grades[i];
average += Grades[i];
}
// get Average
average = average / SIZE;
cout << "Average Grade: " << average << "%" << endl;
return average;
}
/**************************************************
* main function
****************************************************/
int main() {
// display the result
getGrades();
return 0;
}