//-------------------------------------------------------------------- // // Laboratory 2 lab02-ex1.cpp // // Copy of first example problem in prelab section that demonstrates // the standard way to process a point list. This introduces the // standard method for other list implementations (labs 3,4,7,9). // //-------------------------------------------------------------------- #include #include "ptlist.h" using namespace std; void main () { PointList polygon; // Set of vertices for a polygon Point vertex; // Vertex // Read in the polygon's vertices. cout << "Enter the polygon's vertices (end with eof) : "; while ( cin >> vertex.x >> vertex.y && !polygon.isFull() ) polygon.append(vertex); // Output the vertices one per line. if ( !polygon.isEmpty() ) { polygon.gotoBeginning(); // Go to beginning of list do { vertex = polygon.getCursor(); cout << "(" << vertex.x << "," << vertex.y << ")" << endl; } while ( polygon.gotoNext() ); // Go to next point (if any) } }