putting words in alphabetical order

Im having a real hard time trying to figure out how to put words in alphabetical order. My assignment was to take in student names, and 5 exam scores, and then display: STUDENT NAMES IN ALPHABETICAL ORDER, THEIR AVERAGE, and THEIR LETTER GRADE. The program runs fine but doesn't display the student names in "ALPHABETCIAL ORDER".


#include<iostream>
using namespace std;

int main()
{
string name[25];
float avg, sum;
int n,s1,s2,s3,s4,s5, i;
char grade;

cout<<"How many students are you averaging grades for? ";
cin>>n;
for(i=0;i<n;i++)
///....///////
///////PROMPT USER FOR NAME , AND EXAM SCORES
//////./././//

{

cout<<"\nEnter student "<<i+1<<" name: ";
cin>>name[i];

cout<<"\nEnter five examination scores: "<<endl;
cin>>s1>>s2>>s3>>s4>>s5;
cout<<endl;

////////....././////
/////////CALCULATE AVERAGE
/////////././././///


sum = (s1 + s2 + s3 + s4 + s5);
avg = (sum / 5);

//////./././///
///////FIND LETTER GRADE
///.../////////




if(avg >= 90)
grade = 'A';
else if(avg >= 80 && avg < 90)
grade = 'B';
else if(avg >= 70 && avg < 80)
grade = 'C';
else if(avg >= 60 && avg < 70)
grade = 'D';
else if(avg < 60)
grade = 'F';

////..//////
///////DISPLAY RESULTS
////////....//.///




cout<<name[i]<<"'s average is "<<avg<<" which is equivalent to a(n) "<<grade<<endl;
cout<<endl;
}
system("pause");
return 0;
}
Topic archived. No new replies allowed.