// FILE: pointmain2.cxx // This small demonstration shows how the NEW point class is used. // by Zhigang Zhu Fall 2002 #include // Provides cout and cin #include // Provides EXIT_SUCCESS #include "newpoint.h" // Provides the throttle class using namespace std; // Allows all Standard Library items to be used using namespace main_savitch_2B; // all the items can be used in the namespace int shifts_needed(point p) { int answer = 0; while ((p.get_x() <0) || (p.get_y()<0)) { p.shift(1,1); answer++; } return answer; } int shift_to_1st_quad(point& p) { int shifts =0; while ((p.get_x() <0) || (p.get_y()<0)) { p.shift(1,1); shifts++; } return shifts; } int main( ) { point a(-1.1, -2.1); // uses the usual constructor with // two arguments point b(-1.1); // uses 1.1 for the first, // but use default for the second point c; // uses default arguments for both; // default constructor: // no argument, no parentheses! cout << " ************ Default Parameter Test ************" <