// point_example.03.c       Point operators

#include "IntPoint.h"

int main()
{
    IA_Point<int>
	ipoint1(0, 0, 0),  //   initialized to <0 0 0>
	ipoint2,                   // uninitialized point
	ipoint3(1, 2, 3);          //   initialized to <1 2 3>
    
    // Subscripting
    ipoint1[0] = 1;	// new value is <1 0 0>
    ipoint1[2] = 2;	// new value is <1 0 2>

    ipoint2 = ipoint1 + ipoint3;
    // ipoint2 has value <2 2 5>

    // Here we treat the constructor as a function which returns
    //   a new point <0 0 1>, which is subtracted from ipoint2
    ipoint2 -= IA_Point<int>(0, 0, 1);	// new value is <2 2 4>

    cout << "ipoint2 has value " << ipoint2++ << "\n";
    // Prints <2 2 4>, new value of ipoint is <3 3 5>

    cout << "ipoint2 has value " << ipoint2 << "\n";

    return 0;
}
