Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <stdlib.h>
- #include <algorithm>
- using namespace std;
- class Apartment {
- private:
- int nRooms; // - number of rooms
- double q; // - area of apartent
- public:
- Apartment(int nr, double qq)
- {nRooms = nr; q = qq;}
- int get_nRooms() { return nRooms; }
- double get_q() { return q; }
- };
- class Person{
- private:
- string name;
- int age;
- Apartment* apartment;
- public:
- Person(string n, int a, Apartment* ap)
- {name = n; age = a; apartment = ap;}
- string getName(){return name;}
- int getAge(){return age;}
- Apartment* setApartment(Apartment *);
- Apartment* getApartment(){return apartment;}
- };
- int main() {
- vector<Person*> ps;
- string n;
- int age, nr; // nr - number of rooms
- double q; // area of apartment
- while (cin >> n >> age >> nr >> q){
- if (nr == 2) {
- cout << "People with 2 room apartments:" << n << " " << endl;
- cout << "And their quadrature: " << q << endl;
- }
- }
- system("pause");
- }
Add Comment
Please, Sign In to add comment