/////////////////////////////////////////////////////////////// // path.cpp -- represents a path of points // // ver 1.1 // // // // Language: Visual C++, ver 6.0 // // Platform: Dell OptiPlex Gs, Win NT 4.0, sp 3 // // Application: Example for ECS500 // // Author: Jim Fawcett, CST 2-187, Syracuse Univ. // // (315) 443-3948, fawcett@ecs.syr.edu // /////////////////////////////////////////////////////////////// //----< test stub >-------------------------------------------- #ifdef TEST_PATH #include "path.h" #include "point.h" using namespace std; void main() { path P; // void construction using sizing // constructor with default arguments cout << "P's size is " << P.size() << endl; point p1(1.5, -1.5); // coordinate construction of point point p2 = p1; // copy construction of points point p3 = p2; point p4 = p3; // adding four points to path using add function // and taking advantage of its path reference return value P.add(p1).add(p2).add(p3).add(p4); cout << "P's size is " << P.size() << "\n\n"; cout << "\n Testing Copy Constructor " << "\n --------------------------\n\n"; path P1 = P; cout << "after path P1 = P: " << P1 << endl; // adding four points to path // testing automatic resizing cout << "\n Testing add function " << "\n ----------------------\n\n"; path P2(1); cout << "P2's size is " << P2.size() << endl; P2.add(p1).add(p2).add(p3).add(p4); cout << "P2's size is " << P2.size() << "\n\n"; cout << "\n Testing assignment " << "\n --------------------\n\n"; P2 = P1; cout << "after P2 = P1:\n"; cout << P2; // cout << "\n Testing concatenation " << "\n -----------------------\n\n"; path P3; point p5(-1.2,1.2), p6(3.3, 4.4), p7(-8.4,-9.3); P3.add(p5).add(p6).add(p7); cout << " P2:\n" << P2 << " P3:\n" << P3; cout << " P2 + P3:\n" << (P2 + P3); } #endif