LAB #6
Objectives:
Practice the use of the "this" pointer, static data members of a class, and operator overloading. Develop a simple class for complex numbers manipulation, and a class for complex vector manipulation.
Procedure:
Part I.
Part II
3. Develop a class called "Complex" for complex floating point number manipulation. The class should contain data members needed to specify a complex number, and functions to support the operators +, -, *, and to carry out a complex number addition, subtraction, multiplication, and conjugate operations, respectively. Also include functions for the operators +=, -=, and *=.
4. Develop a class "Complex_Vector" for specifying and manipulating vectors whose elements are of type Complex. The length of the vector should be declared as a static constant data member of value 100 and used as a default argument in the constructor function of the class. The member functions of this class should support the operators +, -, * (which stands for a dot product), and the indexing operator [].
5. Write a main() routine to test the classes developed above. Use the indexing operator to add or get elements to a Complex_Vector object. Implement several expressions which involve objects and combine the above operators, and verify their results. For example, let A,B,C, and D be objects of type Complex_Vector, and let x, y, and z be of type Complex, evaluate the following expressions:
z += y *= !x + y,
A[0] = z,
D = A + B + C,
x = (A+B-C) * D