/* Testing class program fcomplex.h which operates with complex numbers */ #include"fcomplex.h" #include void main(){ double a,b,c,d; fcomplex x, y, z, z2; cout << "enter complex number: a (real) b (imag)" << endl; cin >> a >> b; cout << "enter complex number: c (real) d (imag)" << endl; cin >> c >> d; x = fcomplex(a,b); y = fcomplex(c,d); z = x.Cadd(y); cout << endl << "Sum: real, imag " << z.r() << " " << z.i() << endl; z = x.Csub(y); cout << endl << "Sub: real, imag " << z.r() << " " << z.i() << endl; z = x.Cmul(y); cout << endl << "Multip: real, imag " << z.r() << " " << z.i() << endl; z = x.Cdiv(y); cout << endl << "Div: real, imag " << z.r() << " " << z.i() << endl; a = z.Cabs(); cout << endl << "Abs: " << a << endl; z2 = z.Conjg(); cout << endl << "Conjg: " << z2.r() << " " << z2.i() << endl; z2 = z.Csqrt(); cout << endl << "Sqrt: " << z2.r() << " " << z2.i() << endl; z2 = z.RCmul(b); cout << endl << "Real multip: " << z2.r() << " " << z2.i() << endl; z2 = fcomplex(a,0); cout << endl << "Complex from real " << z2.r() << " " << z2.i() << endl; }