Main Page | Namespace List | Alphabetical List | Class List | File List | Class Members | File Members

main_MVector.cpp File Reference

#include "common_defs.h"
#include "MVector.h"

Include dependency graph for main_MVector.cpp:

Go to the source code of this file.

Functions

int main ()


Function Documentation

int main  ) 
 

Definition at line 12 of file main_MVector.cpp.

References MVector::norm().

00013 {
00014     cout << boolalpha;// Sets cout to print bool as true or false (not 1 and 0)
00015 
00016     MSG(Constructors);
00017 
00018     MVector mv0; 
00019     MVector mv1(5, 1.5);
00020     OUT(mv0);
00021     OUT(mv1);
00022     OUT(mv0 == mv1);
00023 
00024     MSG(Assignments);
00025 
00026     EXEC(mv0 = mv1);
00027     OUT(mv0);
00028     OUT(mv0 == mv1);
00029     OUT(mv1 += mv1);
00030     OUT(mv1 -= mv1);
00031 
00032     MSG (Scalar product and norm);
00033 
00034     OUT(mv0.norm());
00035     OUT(mv0 * mv0);
00036 
00037     MSG(Arithmetic operations);
00038 
00039     OUT(mv0 + mv0);
00040     OUT(mv0 - mv0);
00041     try
00042     {
00043         MVector mv2(10);
00044         OUT(mv0 + mv2);
00045     }
00046     catch (MVector::Bad_Dimensions)
00047     {
00048         cerr << "*** Bad dimensions" << endl;
00049     }    
00050 
00051     MSG(Subscript);
00052 
00053     EXEC(mv0[2] = 5.5);
00054     OUT(mv0[2]);
00055     try
00056     {
00057         OUT(mv0[107]);
00058     }
00059     catch (MVector::Out_Of_Bounds)
00060     {
00061         cerr << "*** Out of bounds" << endl;
00062     }
00063 
00064     const MVector cmv = mv1;
00065     OUT(cmv[2]);
00066     // cmv[2] = 3.5; DOES NOT COMPILE
00067 
00068 
00069     return 0;
00070 }

Here is the call graph for this function:


Generated on Mon Dec 12 18:25:43 2005 for Vectors_and_Matrices by  doxygen 1.4.3