// Test program for class ivec #include #include "ivec.h" int main(void) { int a[] = {9,8,7,6}; // calls constructor that takes an array of int ivec v1(a,4); // calls default constructor ivec v2; // test out append v2.append(11); v2.append(12); v2.append(14); v2.append(3); // print out each using overloaded << operator cout << v1 ; cout << v2; // try the array-like access cout << "v1[2] is " << v1[2] << endl; v1[2] = 123; cout << v1; // now try reading from stdin cout << "Enter a vector on one line " << endl; cin >> v1; cout << "Your vector is : " << v1 << endl; cout << "v2 is " << v2 << endl; // try addition v1 = v1 + v2; cout << "v1 is now " << v1 << endl; // now try subtraction v1 = v1 - v2; cout << "v1 is now " << v1 << endl; // test == operator if (v1 == v1 ) { cout << "v1 == v1" << endl; } else { cout << "v1 != v1 !!!!" << endl; } if (v1 == v2 ) { cout << "v1 == v2" << endl; } else { cout << "v1 != v2" << endl; } cout << "v1 is " << v1 << endl; cout << "v2 is " << v2 << endl; if (v1 < v2 ) cout << "v1 < v2 is true" << endl; else cout << "v1 < v2 is false" << endl; }