MasterGun

Untitled

Mar 28th, 2020
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class book
  6. class rectangle {
  7.  
  8.     double side1;
  9.     double side2;
  10.     double AreaCalcutor;
  11.     double PerimetrCalculator;
  12. public:
  13.     rectangle(double _side1, double _side2, double _AreaCalcutor,double _PerimetrCalculator) {
  14.  
  15.         side1 = _side1;
  16.         side2 = _side2;
  17.         AreaCalcutor = _AreaCalcutor;
  18.         PerimetrCalculator = _PerimetrCalculator;
  19.  
  20.     }
  21.     void Area(){
  22.  
  23.         AreaCalcutor = side1 * side2;
  24.     }
  25.     int getcal() {
  26.         return AreaCalcutor;
  27.     }
  28.  
  29.     void Perimetr() {
  30.  
  31.         PerimetrCalculator = (side1 + side2) * 2;
  32.  
  33.     }
  34.     int getcal2() {
  35.         return PerimetrCalculator;
  36.     }
  37.  
  38. };
  39. int main(){
  40.    
  41.    
  42.     double a;
  43.     cin >> a;
  44.     double b;
  45.     cin >> b;
  46.     rectangle r1(a, b, 0, 0);
  47.     r1.Area();
  48.     cout << r1.getcal() << endl;
  49.     r1.Perimetr();
  50.     cout << r1.getcal2() << endl;
  51. system("pause");
  52. return 0;
  53.  
  54. }
RAW Paste Data