#include #include "ComplexT.h" #include using namespace std; void PrintComplex(ComplexT c); int main() { ComplexT a,b,c; a.Both(1,1); b.Both(2,-4); c = a + b; PrintComplex(a); cout << " + "; PrintComplex(b); cout << " = "; PrintComplex(c); cout << endl; return 0; } void PrintComplex(ComplexT c){ float a,b; a = c.Real(); b = c.Imag(); if (a == 0 and b == 0) { cout << 0; } else if (a == 0) { cout << b << "i"; } else { cout << a; if (b < 0){ cout << " - " << abs(b) << "i"; } else if (b > 0) { cout << " + " << b << "i"; } } return; }