Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <queue>
- #include <iostream>
- #include <vector>
- #include <cstring>
- #include <iostream>
- #include <set>
- #include <cstring>
- #include <stack>
- #include <algorithm>
- #include <map>
- #include <cmath>
- //#include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- const int maxn = 3e5 + 10;
- const ll INF = 3e16 + 10;
- struct student {
- string name;
- string surname;
- int age;
- double gpa;
- string college;
- student() {} //empty constructor
- student(string _name, string _surname, int _age, double _gpa, string _college) {
- name = _name;
- surname = _surname;
- age = _age;
- gpa = _gpa;
- college = _college;
- }
- bool operator < (const student &tmp) const {
- return age > tmp.age;
- }
- };
- int main() {
- ios_base::sync_with_stdio(false);
- priority_queue<student> v;
- v.push(student("andrija", "mladenovik", 14, 5.0, "mig"));
- v.push(student("petre", "petreski", 20, 5.0, "finki"));
- v.push(student("alek", "aleksovski", 22, 6.0, "feit"));
- while (!v.empty()) {
- student s = v.top();
- v.pop();
- cout << s.name << " " << s.surname << " " << s.age << " " << s.gpa << " " << s.college << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement