Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #pragma once
  2. #include "Triangle.h"
  3. class RTriangle : public Triangle {
  4. protected: double z;
  5.  
  6.  
  7. public: RTriangle(double ix, double iy, double iz = 0) :Triangle(ix, iy) { z = iz; }
  8. ~RTriangle() { cout << "deleting triangle" << endl; }
  9. void print() { cout << "a triangle with sodes" << x << "and" << y << "and " << z << endl; }
  10. void area() {
  11. double p_2 = 0.5*(x + y + z);
  12. double s = sqrt(p_2*fabs(p_2 - x)*fabs(p_2 - y)*fabs(p_2 - z));
  13. cout << "has an area of " << s << endl;
  14. }
  15. void obwod() { cout << "has a perimeter of" << x << y << z << endl; }
  16.  
  17. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement