Create an Account

Already have account?

Forgot Your Password ?

Home / Questions / Finish the C++ code which implements the complex number x + yi class class our Complex f p...

Finish the C++ code which implements the complex number x + yi class class our Complex f private: nix; //real port of complex number int y image port of a complex number public our Complex

Finish the C++ code which implements the complex number (x + yi) class class ourComplex f private: nix; //real port of °complex number int y; //image port of a complex number public: ourComplex() f x = y= 0; ) ourComplexhnt x, of yll this->x = x; this >y r y,
ourComplex operato•(const ourComplex &other); ourComplex operatoryInt I);
void print()/ tout « iffy> 0) cout« « y « "a' «mg
else
/
(Out« y "a' «endl;
ourComplex ourCompler.operator(const ourComplex &other)l ourComplex temp; emp.x • x • others - y • other. y; temp.? • x • othety e y • °therm; return temp;
/
You should overload'"' operator (the highlighted part in the code above) to allow exponential operation on a complex number. The -"" operator takes an integer as parameter. For instance, if one has a complex object, a: ourComplex a(1, 2); //obviously, a is 1+2i ourComplex b = a" 4; //that is,a • a • a • a // Now b's value is: -7-24i

May 27 2020 View more View Less

Answer (Solved)

question Subscribe To Get Solution

Related Questions