00001 #include "starlab_vector.h" 00002 00006 00007 main(int argc, char** argv) 00008 { 00009 check_help(); 00010 00011 vector x(1.0); 00012 vector y(x+1.0); 00013 vector z(x+y); 00014 00015 cout << "x = "; x.print(); 00016 cout << "y = "; y.print(); 00017 cout << "z = "; z.print(); 00018 00019 cout << "-x = "; (-x).print(); 00020 00021 cout << "y.z = " << y*z << "\n"; 00022 00023 cout << "x+y = "; (x+y).print(); 00024 cout << "x-y = "; (x-y).print(); 00025 cout << "x+1 = "; (x+1).print(); 00026 cout << "1+x = "; (1+x).print(); 00027 cout << "x+y+z = "; (x+y+z).print(); 00028 00029 cout << "2*x = "; (2*x).print(); 00030 cout << "x*2 = "; (x*2).print(); 00031 00032 z = x; 00033 cout << "z = "; z.print(); 00034 cout << "|z| = " << abs(z) << "\n"; 00035 00036 cout << "|2x-4(y+z)| = " << abs(2*x-4*(y+z)) << "\n"; 00037 00038 cout << "test of x = vector(1001, 1002, 1003); : "; 00039 x = vector(1001, 1002, 1003); 00040 x.print(); 00041 cout << "test of x = 8; : "; 00042 x = 8; 00043 x.print(); 00044 00045 vector a(1,2,3); 00046 00047 cout << "test of a = (1,2,3) : a = " << a << endl; 00048 cout << "test of a[2] : a[2] = " << a[2] << endl; 00049 cout << "test of a[2] = 5 : a = " ; 00050 a[2] = 5; 00051 cout << a << endl; 00052 }