Пример #1
0
Complex operator+(double d, const Complex &c1) {
	return Complex(c1.getReal()+d, c1.getImaginary());
}
Пример #2
0
Complex operator+(const Complex &c1, const Complex &c2) {
	return Complex(c1.getReal()+c2.getReal(), c1.getImaginary()+c2.getImaginary());
}
 Complex operator * (const Complex & rhs) const
 {
     return Complex(m_real * rhs.getReal() - m_imaginary * rhs.getImaginary(), m_imaginary * rhs.getReal() + m_real * rhs.getImaginary());
 }
Пример #4
0
void printComplex(Complex& q){
    cout << "Real part: " << q.getReal() << endl;
    cout << "Imaginary part: " << q.getImaginary() << endl << endl;
}
 Complex operator - (const Complex & rhs) const
 {
     return Complex(m_real - rhs.getReal(), m_imaginary - rhs.getImaginary());
 }