**fig1_8.txt** /* 1*/ Complex::Complex( const Complex & Value ) /* 2*/ { /* 3*/ Real_Part = Value.Real_Part; /* 4*/ Imag_Part = Value.Imag_Part; /* 5*/ } /* 6*/ const Complex & Complex::operator = ( const Complex & Value ) /* 7*/ { /* 8*/ if( this != &Value ) /* 9*/ { /*10*/ Real_Part = Value.Real_Part; /*11*/ Imag_Part = Value.Imag_Part; /*12*/ } /*13*/ return *this; /*14*/ } /*15*/ const Complex & Complex::operator += ( const Complex & Value ) /*16*/ { /*17*/ Real_Part += Value.Real_Part; /*18*/ Imag_Part += Value.Imag_Part; /*19*/ return *this; /*20*/ } /*21*/ ostream & operator << ( ostream & Out, const Complex & Value ) /*22*/ { /*23*/ Out << Value.Real_Part << " + " << Value.Imag_Part << "i"; /*24*/ return Out; /*25*/ } /*26*/ Complex operator +( const Complex & A, const Complex & B ) /*27*/ { /*28*/ return Complex( A.Real_Part + B.Real_Part, /*29*/ A.Imag_Part + B.Imag_Part ); /*30*/ } /*31*/ Complex operator -( const Complex & A, const Complex & B ) /*32*/ { /*33*/ return Complex( A.Real_Part - B.Real_Part, /*34*/ A.Imag_Part - B.Imag_Part ); /*35*/ } /*36*/ Complex operator -( const Complex & A ) /*37*/ { /*38*/ return Complex( -A.Real_Part, -A.Imag_Part ); /*39*/ } /*40*/ Complex operator *( const Complex & A, const Complex & B ) /*41*/ { /*42*/ return Complex( /*43*/ A.Real_Part * B.Real_Part - A.Imag_Part * B.Imag_Part, /*44*/ A.Real_Part * B.Imag_Part + A.Imag_Part * B.Real_Part ); /*45*/ } /*46*/ // Assumes that B is non zero. /*47*/ Complex operator /( const Complex & A, const Complex & B ) /*48*/ { /*49*/ Real Modulus = /*50*/ B.Real_Part * B.Real_Part + B.Imag_Part * B.Imag_Part; /*51*/ Complex Temp( B.Real_Part / Modulus, -B.Imag_Part / Modulus ); /*52*/ return A * Temp; /*53*/ }