1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
//--- Test.cpp
#include <iostream>
#include "vertex.h"
#include "Polygon.h"
#include "Circle.h"
#include "ShapeList.h"
using namespace std;
int main()
{
ShapeList list;
Vertex varr[] = { Vertex(0, 0), Vertex(10, 0), Vertex(5, 2), Vertex(5, 5) };
list.add(Polygon(1, 4, varr, 4));
list.add(Rectangle(4, 10, 2, 4));
list.add(Circle(5, 5, 3));
list.add(Point(6, 7, 1));
Vertex nyarr[] = { Vertex(1, 1), Vertex(9, 2) };
list.add(Polygon(6, 8, nyarr, 2));
list.add(Rectangle(10, 4, 4, 2));
list.add(Circle(3, 3, 5));
list.add(Point(9, 6, 1));
list.print();
cout << "Total Area: " << list.area() << endl;
ShapeList list2(list);
list2.print();
cout << "Total Area: " <<list2.area() << endl;
list.remove(Vertex(5, 5));
list.print();
cout << "Total Area: " << list.area() << endl;
list2.print();
cout << "Total Area: " << list2.area() << endl;
return 0;
}
|