Advertisement
Alx09

Untitled

May 13th, 2020
1,672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. class forma_geo
  6. {
  7. protected:
  8.     int raza;
  9.  
  10.  
  11. public:
  12.     void set_raza(int r)
  13.     {
  14.         raza = r;
  15.     }
  16.  
  17.  
  18. };
  19.  
  20. class cost
  21. {
  22. public:
  23.     float calcul(float aria)
  24.     {
  25.         return (aria*350);
  26.     }
  27. };
  28.  
  29. class cerc: public forma_geo, public cost
  30. {
  31. public:
  32.     float get_aria()
  33.     {
  34.         return(raza*raza* 3.14);
  35.     }
  36. };
  37.  
  38. int main ()
  39. { cerc c1;
  40.  int r;
  41.   cout <<"Introduce ti raza: "; cin >> r;
  42.   c1.set_raza(r);
  43. cout<<"\nAria formei geometrice este "<<c1.get_aria()<<endl;
  44. cout<<"Costul total este "<<c1.calcul(c1.get_aria())<<endl;
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement