#include "complex.h" using namespace std; int main() { Complex z1; cout << "z1 = " << z1 << endl; Complex z2( 3.4 ); cout << "z2 = " << z2 << endl; Complex z3( 4.5, -2 ); cout << "z3 = " << z3 << endl; Complex z4( z3 ); cout << "z4 = " << z4 << endl; z1 = 2; // How does this work??? cout << "z1 is now " << z1 << endl; cout << "z2's real part is " << z2.Real() << ", and its imaginary part is " << z2.Imaginary() << endl; z2.SetReal( -10 ); z2.SetImaginary( 20 ); cout << "z2 is now " << z2 << endl; cout << "The magnitude of z2 is " << z2.Magnitude() << endl; Complex w = z2 + z4; cout << " w = z2 + z4 so w is " << w << endl; Complex a = z2 - z4; cout << " a = z2 - z4 so a is " << a << endl; Complex d; cout << "Input your own complex number as two consecutive floats: "; cin >> d; cout << "\nThe number input is " << d << endl; /* Complex b = z2 * z4; cout << " b = z2 * z4 so b is " << b << endl; Complex c = z2 * z4; cout << "operator == (b,c) " << (b==c) << " --- should be 1" << endl; cout << "operator == (a,c) " << (a==c) << " --- should be 0" << endl; a = -b; cout << "a = -b; a is now " << a << endl; w += b; cout << "w += b; w is now " << w << endl; */ return 0; }