I figure out how to do it but with a simple problem.
I add to the previous post`s code the following
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
bool doMore;
do {
doMore = false; // assume this is last pass over array
for (int i=0; i<10-1; i++) {
if (student[i].studentName > student[i+1].studentName) {
// exchange elements
classroom temp = student[i]; student[i] = student[i+1]; student[i+1] = temp;
doMore = true; // after exchange, must look again
}
}
} while (doMore);
for (int j=0;j<10;j++)
{
cout<<student[j].studentName;
cout<<endl;
}