Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <stdio.h>
- #include <cmath>
- #include <iomanip>
- using namespace std;
- struct person{
- string name;
- string surname;
- double GPA;
- };
- bool operator< (person a, person b){
- if (a.GPA < b.GPA)
- return true;
- else
- return false;
- }
- double eps = 0.000001;
- int main(){
- int n;
- cin >> n;
- vector<person> v(n);
- for (int i = 0; i < n; i++){
- cin >> v[i].name >> v[i].surname >> v[i].GPA;
- }
- sort(v.begin(), v.end());
- for (int i = 0; i < n; i++){
- cout << v[i].GPA << " " << v[i].name << " " << v[i].surname << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement