daily pastebin goal
38%
SHARE
TWEET

Уреди дом

a guest Dec 15th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. class Masa {
  6.     private:
  7.         int dolzina, sirina;
  8.     public:
  9.         Masa(){}
  10.         Masa(int dolzina, int sirina){
  11.             this->dolzina=dolzina;
  12.             this->sirina=sirina;
  13.         }
  14.     void pecati() {
  15.         cout<<"Masa: "<<dolzina<<"  "<<sirina<<"  "<<endl;
  16.     }
  17. };
  18.  
  19. class Soba {
  20.     private:
  21.         Masa masa;
  22.         int dolzina, sirina;
  23.     public:
  24.         Soba(){}
  25.         Soba(int dolzina, int sirina, Masa masa){
  26.             this->masa=masa;
  27.             this->dolzina=dolzina;
  28.             this->sirina=sirina;
  29.         }
  30.     void pecati() {
  31.         cout<<"Soba: "<<sirina<<"  "<<dolzina<<"  "<<endl;
  32.         masa.pecati();
  33.     }
  34. };
  35.  
  36. class Kukja {
  37.     private:
  38.         Soba soba;
  39.         char adresa[50];
  40.     public:
  41.         Kukja(){}
  42.         Kukja(Soba soba, char adresa[50]){
  43.             this->soba=soba;
  44.             strcpy(this->adresa, adresa);
  45.         }
  46.     void pecati() {
  47.         cout<<"Adresa: "<<adresa<<"  "<<endl;
  48.         soba.pecati();
  49.     }
  50.     ~Kukja(){}
  51. };
  52.  
  53.  
  54. int main(){
  55.     int n;
  56.     cin>>n;
  57.     for(int i=0;i<n;i++){
  58.         int masaSirina,masaDolzina;
  59.         cin>>masaSirina;
  60.         cin>>masaDolzina;
  61.         Masa m(masaSirina,masaDolzina);
  62.         int sobaSirina,sobaDolzina;
  63.         cin>>sobaSirina;
  64.         cin>>sobaDolzina;
  65.         Soba s(sobaSirina,sobaDolzina,m);
  66.         char adresa[30];
  67.         cin>>adresa;
  68.         Kukja k(s,adresa);
  69.         k.pecati();
  70.     }
  71.    
  72.     return 0;
  73. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top