Hi, one of my assignment is to sort the names and grades of the students. This should output after everything has been coded:

If the data is as follows:

Joe 45
Jim 55
Sam 90

...Then the output will be
Jim 55
Joe 45
Sam 90

There was 1 A
There were 2 F's
The highest grade was 90
The lowest grade was 45

and then...

Sam 90
Jim 55
Joe 45


final out put shoud be:

There was 1 A.
There were 2F's
The highest grade was 90
The lowest grade was 45.


The names and grades are stored in a text file:

Sam 90
Joe 45
Jim 55

Here's I got so far..if you can help me do the above..please help ..

void AlphaSort (Str names[], int count)
{
// Sorts the grades alphabetically
}
void GradeSort (int grades[], int count)
{
// Sorts the grades in descending order
int i,j,temp,largest;
for (i=0; i<count-1; i++)
{
largest=i;
for (j=largest+1;j<count; j++)
if (grades[j]>grades[largest]) largest=j;
temp=grades[largest];
grades[largest]=grades[i];
grades[0]=temp;
}
}
void GradeCount (int grades[], int count)
{
// Counts the number of A's, B's, C's, D's, and F's
}
void PrintAll (Str names[], int grades[], int count)
{
// Function created to test input, make sure file is read correctly.
cout << "The file contains:"<<endl;
for (int i=0; i<count; i++)
cout << names[i] << '\t' << grades[i]<<endl;
}
int main(void)
{
Str names[40];
int grades[40];
char fn[256];
cout << "Please enter a filename: ";
cin >> fn;
ifstream infile(fn);
int i=0;
while (!infile.eof())
{
infile >> names[i] >> grades[i];
i++;
}
PrintAll(names,grades,i);
GradeSort(grades,i);
cout<<endl<<"The grades should be sorted now:"<<endl;
PrintAll(names,grades,i);
infile.close();
return 0;
}