Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- struct slog {
- string ime, prezime;
- double uspeh;
- }
- ucenik[1005];
- bool cmp(slog a, slog b){
- return a.uspeh < b.uspeh or a.uspeh == b.uspeh and a.ime < b.ime or a.uspeh == b.uspeh and a.ime == b.ime and a.prezime < b.prezime;
- }
- int brojUcenika;
- int main() {
- cin >> brojUcenika;
- for (int i = 1; i <= brojUcenika; i++) {
- cin >> ucenik[i].ime >> ucenik[i].prezime >> ucenik[i].uspeh;
- }
- sort(ucenik+1, ucenik+brojUcenika+1, cmp);
- for (int i = 1; i <= brojUcenika; i++) {
- cout << ucenik[i].ime << " " << ucenik[i].prezime << " " << ucenik[i].uspeh << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement