// Test of the complex class // Michael Rothstein // 07/27/2014 #include #include "Complex.h" using std::cin; using std::cout; using std::endl; const Complex I(0.0,1.0); void print(Complex a){ cout << a.real() << " + I * " << a.imag(); } int main(){ Complex a(1.0,1.0),b(3.0,1.0),c(4.0,2.0); Complex d; cout << "a = "; print(a); cout << endl; cout << " a *I = "; print(a+I); cout << endl; cout << "b = "; print(b); cout << endl; cout << " b *I = "; print(b*I); cout << endl; cout << "c = "; print(c); cout << endl; cout << " c *I = "; print(c*I); cout << endl; cout << "(3+I)*(4+i)= "; print(b*c); cout << endl; if ( a + b == c ) { cout << "It works!\n"; } else { cout << "Something failed.\n"; } return 0; }