We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Complexoperator+(constComplex&c1,constComplex&c2){Complexresult;result.a=c1.a+c2.a;// Sum of real partsresult.b=c1.b+c2.b;// Sum of imaginary partsreturnresult;}std::ostream&operator<<(std::ostream&os,constComplex&c){os<<c.a<<"+i"<<c.b;returnos;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Overload Operators
You are viewing a single comment's thread. Return to all comments →