0
Come on... I have a class Student, which contains the attributes name, idCurst and situation. I also have a vector that stores several objects of the Student type. I also have a method ordain() that returns to me a vector ordered by course. Follows the method:
vector<Aluno> ordenaPorCurso(Vector<Aluno> lista){
for(int i = 0 ; i < lista.size() ; i++){
for(int j = i ; j < lista.size() ; j++){
if(lista[i].getCurso() >= lista[j].getCurso()){
Aluno temp = lista[j];
lista[j] = lista[i];
lista[i] = temp;
}
}
}return lista;
My question is this: I need to create a method that sorts by course And Name and I’m stuck. Someone can help me?
Grateful.
Makes a < operator Overload saying how you want instances of the Student class to be ordered. Then you can use the Sort function to sort your vector.
– user142154