I hope I am postin gin the right spot.I am new to this site.
I need help with sorting the grades, please. Can anyone help?Thanks
include<iostream>
#include<iomanip>
using namespace std;
int main()
{
double *grades; //point used to point to an array that holds grad
double total = 0.0; // total of grades
double average; // holds the average grades
int count; // loop counter
int numGrades; //grades that will be processed
//get the number of months
cout <<"How many grades will be processed?" << endl;
cin >>numGrades;
//allocate memory for the number of grades
grades= new double[numGrades];
//Get the grades
cout <<"enter the grades below."<< endl;
for(count=0; count < numGrades; count++ )
{
cout << "Grade " << (count + 1) << ":";
cin >> grades[count];
}
//calculate the grades
for(count=0;count <numGrades;count++)
{
total += grades[count];
}
//calculate the average grades
average += total/numGrades;
//Display the results
cout << fixed <<showpoint << setprecision(1);
cout <<"\n\nTotal Grades: " << total << endl;
cout <<"Average Grade: " << average << endl;
//Free dynamically allocated memory
delete [] grades;
grades= 0;
system("Pause");
return 0;
}