0
Find the highest grade
Input: First line contains n(0 < n < 1001). Then n lines inputed in given format: First number - student's ID Second element - student's name(not more that 100) Third number - the final grade of the student Output: n lines sorted by grades(Note:If two students have same grades your have to sort them by ID) Samples: INPUT OUTPUT 3 2 Zuckerberg 99.1 1 Ivano 51 2 Zuckerberg 99.1 3 Mendelson 99.0 How to solve it? This is my code: https://code.sololearn.com/cm9Vp6qZK2CW/#cpp
7 Respuestas
0
printing top value :
void out(Student* s, int n) {
Student* it = s;
cout << it->ID << " " << it->surname << " " << it->grade << endl;
}
}
+ 1
if ((s + j)->grade < s[j + 1].grade)
Just Use < instead of >
0
What do you mean?
0
I mean in line number 37 : make that change
Edit : Azat Malgazhdar
This
if ((s + j)->grade < s[j + 1].grade)
0
I need only one answer in this code
Id_surname_grade who has highest one
0
Thank you!
0
You're welcome...