sorting names

hey guys !!!
i have to sort the students according to their first and last names
here is the code i have written so far ,, it inputs the first names and last names and then it stops working . please help me with this ,, thank u ..

#include <iostream>
#include <string>
using namespace std;
struct Student
{
string FirstName ;
string LastName ;

};
Student* inputFromUser (Student *S );
//void SortArray (Student *S);
//Student* showStudents (Student *S);
int main ()
{
Student s ;

s = *inputFromUser(&s);
//s = *showStudents(&s);
//SortArray(&s);
system("pause");
return 0 ;
}
Student* inputFromUser (Student *S)
{
for ( int i = 0 ; i<4 ; i++)
{
Student *S = new Student [4] ;
cout << " enter the first name " << endl;
cin >> S[i].FirstName ;
cout << " enter last name " << endl;
cin >> S[i].LastName ;


}
cout << " the names entered were " << endl;
for ( int i = 0 ; i<4 ; i++ )
{
cout << S[i].FirstName << " " << S[i].LastName << endl;
}
return S ;
}
/*Student* showStudents (Student *S)
{

return S ;
}*/
/*void SortArray (Student *S)
{
string temp[10] ;
string temp1[10] ;
for (int i = 0 ; i<10 ; i++ )
{
if (S[i].FirstName >S[i+1].FirstName && S[i].LastName > S[i+1].LastName)
{
temp[i] = S[i].FirstName ;
temp1[i] = S[i].LastName ;

cout << temp[i] << " " << temp1[i] << endl;
}
}
}
*/

Topic archived. No new replies allowed.