// PointTest.cpp Tests the Point class #include "Point.h" ///////////////////////////////////////////////////////////////////////// void OutPoint ( const Point& p, ostream& os ); ///////////////////////////////////////////////////////////////////////// int main() { ofstream os; os.open( "Point.out" ); // It is interesting to note how this program keeps track of the // the number of points using the static member data "numPoints". // Note that call-by value parameters use the copy constructor. os.setf(ios::fixed); os.setf(ios::showpoint); os.precision(3); Point j; cout << "Program Point.cpp\n"; cout << "Input two real values representing the x and y coordinates.\n"; cin >> j; // Call to >> os << "The point input called j was " << j << endl; // Call to << Point a, b(-4.0), c(0.0,-3.0), d; // constructors os << "point a: "; OutPoint( a, os ); os << endl; os << "point b: "; OutPoint( b, os ); os << endl; os << "point c: "; OutPoint( c, os ); os << "\n"; d = b; os << "Test assignment after d = b;" << " point d: "; OutPoint( d, os ); os << endl; d = c; os << "Test assignment after d = c;" << " point d: "; OutPoint( d, os ); os << "\n"; os << "After allocating j,a,b,c,d, numCount is " << Point::GetCount() << endl; double ab_dist = Distance( a,b); double ac_dist = Distance( a,c); double bc_dist = Distance( b,c); os << "distance a,b :" << setw(7) << ab_dist << endl; os << "distance a,c :" << setw(7) << ac_dist << endl; os << "distance b,c :" << setw(7) << bc_dist << endl; Point ab_slope = Slope(a,b); Point ac_slope = Slope(a,c); Point bc_slope = Slope(b,c); os << "After allocating three more Points, numCount is " << Point::GetCount() << endl; os << "slope ab : "; OutPoint( ab_slope, os ); os << endl; os << "slope ac : "; OutPoint( ac_slope, os ); os << endl; os << "slope bc : "; OutPoint( bc_slope, os ); os <<"\n"; double ab_slope_double = SlopeDouble(a,b); double ac_slope_double = SlopeDouble(a,c); double bc_slope_double = SlopeDouble(b,c); os << "slope ab double :" << setw(7) << ab_slope_double << endl; os << "slope ac double :" << setw(7) << ac_slope_double << endl; os << "slope bc double :" << setw(7) << bc_slope_double <<"\n"; int quad_a = a.Quadrant(); int quad_b = b.Quadrant(); int quad_c = c.Quadrant(); int quad_j = j.Quadrant(); os << "quadrant of a : " << quad_a << endl; os << "quadrant of b : " << quad_b << endl; os << "quadrant of c : " << quad_c << endl; os << "quadrant of j : " << quad_j << endl; double OriginDistance_a = a.RayDistance(); double OriginDistance_b = b.RayDistance(); double OriginDistance_c = c.RayDistance(); double OriginDistance_j = j.RayDistance(); os << "Distance from [0,0] to a :"<