0

hello, I am having problem with selection sort, I am trying to sort the students name alphabetically.I compile it and it shows me whole bunch of errors in VS.

I dont think it has do to do with my display all students function, I think it has more to do with SortByName and SortByScoreFunctions

any help is appreciated thank you!

here is the struct for my program.

```
struct StudentType
{
string studentName;
int testScore;
char grade;
};
void SortStudentsByName(StudentType student[], int numStudents)
{
int startScan, minIndex, FirstInAlphabet;
for (startScan = 0; startScan < (NUM_STUDENTS-1); startScan++)
{
minIndex = startScan;
FirstInAlphabet = student[0];
for( int index = startScan+1; index < NUM_STUDENTS; index++)
{
if ( student[index] > FirstInAlphabet)
{
FirstInAlphabet = student[index];
minIndex = index;
}
}
}
}
void SortStudentsByScore(StudentType student[], int numStudents)
{
int startScan,
minIndex,
lowest;
for (startScan = 0; startScan < (NUM_STUDENTS-1); startScan++)
{
minIndex = startScan;
lowest = student[0].testScore;
for ( int index = startScan+1; index < NUM_STUDENTS; index++)
{
if( student[index].testScore < lowest)
{
lowest = student[index].testScore;
minIndex = index;
}
}
student[minIndex].testScore = student[startScan].testScore;
student[startScan].testScore = lowest;
cout <<"List of Students sorted by Score from Highest to Lowest" << endl;
DisplayAllStudents(student, numStudents);
}
}
void DisplayAllStudents(const StudentType student[], int numStudents)
{
cout << endl;
FormatNameScoreGrade(cout);
for(int i = 0; i < numStudents; i++)
{
cout << setw(20) << student[i].studentName << setw(10) << student[i].testScore << setw(10) << student[i].grade << endl;
}
cout << endl;
EndOfList(cout);
}
```