Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Datum {
- private:
- int den, mesec, godina;
- public:
- Datum(int _den = 0, int _mesec = 0, int _godina = 0) {
- den = _den;
- mesec = _mesec;
- godina = _godina;
- }
- ~Datum() {}
- int get_den() {
- return den;
- }
- int get_mesec() {
- return mesec;
- }
- int get_godina() {
- return godina;
- }
- };
- class Vraboten {
- private:
- string ime;
- int plata;
- Datum raganje;
- public:
- Vraboten(string _ime = "", int _plata = 0, Datum _ragane = Datum()) {
- ime = _ime;
- plata = _plata;
- raganje = _ragane;
- }
- int get_plata() {
- return plata;
- }
- Datum get_datum() {
- return raganje;
- }
- };
- Vraboten najgolema_plata(Vraboten arr[], int n) {
- int plata = 0;
- Vraboten v;
- for(int i = 0; i < n; i++) {
- if(plata < arr[i].get_plata()) {
- plata = arr[i].get_plata();
- v = arr[i];
- }
- }
- return v;
- }
- Vraboten najmlad(Vraboten arr[], int n) {
- int den = 3000, mesec = 3000, godina = 3000;
- Vraboten v;
- for(int i = 0; i < n; i++) {
- Datum d = arr[i].get_datum();
- if(den >= d.get_den() and mesec >= d.get_mesec() and godina >= d.get_godina()) {
- den = d.get_den();
- mesec = d.get_mesec();
- godina = d.get_godina();
- v = arr[i];
- }
- }
- return v;
- }
- int main()
- {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement