fork download
  1. #include<iostream>
  2. #include<cmath>
  3. #include "square.h"
  4. using namespace std;
  5.  
  6. Square::Square():Quadrilateral()
  7. {
  8. a = Point(2,2);
  9. b = Point(5,2);
  10. c = Point(5,5);
  11. d = Point(2,5);
  12. }
  13.  
  14. Square::Square(Point &p1, Point &p2, Point &p3, Point &p4):
  15. Quadrilateral(p1,p2,p3,p4)
  16. {
  17. validate();
  18. }
  19.  
  20. void Square::SetAll(Point &p1, Point &p2, Point &p3, Point &p4)
  21. {
  22. Quadrilateral::SetAll(p1,p2,p3,p4);
  23. validate();
  24. }
  25.  
  26. double Square::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 Square::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 * side1);
  42. }
  43.  
  44. void Square::Print()
  45. {
  46. cout << "I'm a Square" << 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:20: fatal error: square.h: No such file or directory
 #include "square.h"
                    ^
compilation terminated.
stdout
Standard output is empty