什么是单数什么是复数(什么是复数)

导读 class Complex{public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r;imag=i;} Complex operator+(Complex& c2);...

class Complex{public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r;imag=i;} Complex operator+(Complex& c2); Complex operator*(Complex& c2);private: double real; double imag;};Complex Complex::operator+(Complex& c2){ return Complex(real+c2.real,imag+c2.imag);}Complex Complex::operator*(Complex& c2){return Complex (real*c2.real-imag*c2.imag,real*c2.imag+imag*c2.real);}。

免责声明:本文由用户上传,如有侵权请联系删除!