fork download
  1. #include<iostream>
  2. #include<cmath>
  3. #include "rectangle.h"
  4. using namespace std;
  5.  
  6. Rectangle::Rectangle():Quadrilateral()
  7. {
  8. a = Point(1,3);
  9. b = Point(5,3);
  10. c = Point(5,5);
  11. d = Point(1,5);
  12. }
  13.  
  14. Rectangle::Rectangle(Point &p1, Point &p2, Point &p3, Point &p4):
  15. Quadrilateral(p1,p2,p3,p4)
  16. {
  17. validate();
  18. }
  19.  
  20. void Rectangle::SetAll(Point &p1, Point &p2, Point &p3, Point &p4)
  21. {
  22. Quadrilateral::SetAll(p1,p2,p3,p4);
  23. validate();
  24. }
  25.  
  26. double Rectangle::Perimeter()
  27. {
  28. double side1 = a.Distance(b);
  29. double side2 = b.Distance(c);
  30. double side3 = c.Distance(d);
  31. double side4 = d.Distance(a);
  32. return(side1 + side2 + side3 + side4);
  33. }
  34.  
  35. double Rectangle::Area()
  36. {
  37. double side1 = a.Distance(b);
  38. double side2 = b.Distance(c);
  39. double side3 = c.Distance(d);
  40. double side4 = d.Distance(a);
  41. return(side1 * side2);
  42. }
  43.  
  44. void Rectangle::Print()
  45. {
  46. cout << "I'm a Rectangle" << endl;
  47. Quadrilateral::Print();
  48. }
  49.  
  50.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:23: fatal error: rectangle.h: No such file or directory
 #include "rectangle.h"
                       ^
compilation terminated.
stdout
Standard output is empty