Hello,

I am trying to write a program that will simply output the sum and product of complex numbers. I am having a difficult time getting it to work properly. Any ideas would be appreciated.

Code:#include <iostream> using namespace std; class complex { public: void printNumber() const; int getReal() const; int getImaginary() const; complex addNumbers(); complex multiplyNumbers(); cons(); private: int a; int b; }; int main() { complex x = new complex(3,4); complex y = new complex(9,8); cout << "When the program first executes you have empty vales: "; x.printNumber(); y.printNumber(); cout << endl << endl; cout << "When you add the complex numbers, you'll get this: "; x.getReal(x); y.getReal(y); x.addNumbers(x); y.addNumbers(y); x.printNumber(x); y.printNumber(y); cout << endl << endl; cout << "When you multiple the complex numbers, you'll get this: "; x.getReal(x); y.getReal(y); x.multiplyNumbers(x); y.multiplyNumbers(y); x.printNumber(); y.printNumber() cout << endl << endl; return 0; } void complex::printNumber() const { cout << a << " + " << b << "i"; } int complex::getReal() const { x = a; return x; } complex complex::getImaginary() const { y = b; return complex; } complex complex::addNumbers (x) { x.getReal(); x = a + b; return complex; } complex complex::multiplyNumbers (y) { y.getImaginary(); result = a * b; return complex; }