Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main() {
- Point *p1 = new Point(0, 0);
- Point *p2 = new Point(0, 4);
- Point *p3 = new Point(4, 4);
- Point *p4 = new Point(4, 0);
- Point *p5 = new Point(4, -4);
- Point *p6 = new Point(0, -4);
- cout << "---POINT---" << endl;
- cout << p1->getDistance(p2) << endl; // 4
- cout << p1->getDistance(p6) << endl; // 4
- cout << p1->getDistance(p3) << endl; // 5.65685
- /*
- cout << "---LINE---" << endl;
- Line *l1 = new Line(p1, p2);
- Line *l2 = new Line(p1, p3);
- Line *l3 = new Line(p3, p1);
- Line *l4 = new Line(p3, p6);
- cout << l1->getLength() << endl; // 4
- cout << l2->getLength() << endl; // 5.65685
- cout << l3->getLength() << endl; // 5.65685
- cout << l4->getLength() << endl; // 8.94427
- cout <<"a1 " << l1->getA() << " | b1 " << l1->getB() << endl;
- cout <<"a2 " << l2->getA() << " | b2 " << l2->getB() << endl;
- cout <<"a3 " << l3->getA() << " | b3 " << l3->getB() << endl;
- cout <<"a4 " << l4->getA() << " | b4 " << l4->getB() << endl;
- */
- cout << "---SHAPE---" << endl;
- Shape *s1 = new Shape();
- s1->addPoint(p1);
- s1->addPoint(p2);
- s1->addPoint(p3);
- s1->addPoint(p4);
- cout << s1->getCircumference() << endl; // 16
- cout << s1->getArea() << endl; // 16
- Shape *s2 = new Shape();
- s2->addPoint(p1);
- s2->addPoint(p2);
- s2->addPoint(p3);
- s2->addPoint(p4);
- s2->addPoint(p5);
- s2->addPoint(p6);
- cout << s2->getCircumference() << endl; // 24
- cout << s2->getArea() << endl; // 32
- cout << s2->getPoint(3)->getDistance(s2->getPoint(2)) << endl; //4
- cout << "---TRIANGLE---" << endl;
- Triangle *t1 = new Triangle(p1, p2, p3);
- cout << t1->getCircumference() << endl; // 13.6569
- cout << t1->getArea() << endl; // 8
- Triangle *t2 = new Triangle(p1, p3, p5);
- cout << t2->getCircumference() << endl; // 19.3137
- cout << t2->getArea() << endl; // 16
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement