Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // your code here
- #include <iostream>
- #include <cstring>
- using namespace std;
- class Table{
- private:
- int width;
- int height;
- public:
- Table()
- {
- width = 0;
- height = 0;
- }
- Table (int width, int height)
- {
- this->width=width;
- this->height=height;
- }
- ~Table(){};
- void print()
- {
- cout<< "Table: " << width << " " << height;
- }
- };
- class Room{
- private:
- Table t;
- int length;
- int width;
- public:
- Room (){}
- Room (int width, int length, Table t)
- {
- this->width = width;
- this->length = length;
- this->t = t;
- }
- void print()
- {
- cout<< "Room: " << width << " " << length << " ";
- t.print();
- }
- };
- class House {
- private:
- char address[50];
- Room r;
- public:
- House (Room r, char *address)
- {
- this->r = r;
- strcpy(this->address, address);
- }
- void print()
- {
- //Address: Goce_Delcev_20 Room: 10 20 Table: 2 4
- cout << "Address: " << address << " ";
- r.print();
- cout << " " << endl;
- }
- };
- int main(){
- int n;
- cin>>n;
- for(int i=0;i<n;i++){
- int tableWidth, tableHeight;
- cin>>tableWidth;
- cin>>tableHeight;
- Table t(tableWidth, tableHeight);
- int rw, rl;
- cin>>rw;
- cin>>rl;
- Room r(rw, rl, t);
- char adresa[30];
- cin>>adresa;
- House h(r,adresa);
- h.print();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement