0

Hey i wrote this program but im getting some type of error in one of the lines of my code. This program is suppose to add, subtract, and print the complex numbers. I wont type out the whole assignment but this is basically what it does. I'll really appreciate it if someone can help me with this program. My code is at the bottom

```
#include <iostream>
#include <iomanip>
using namespace std;
// class declaration
class Complex {
public:
Complex( double = 0.0, double = 0.0 ); // default constructor
Complex addition( const Complex & );
Complex subtraction( const Complex & );
void printComplex( void );
void setComplexNumber( double, double );
private:
double realPart;
double imaginaryPart;
};
// member functions definition
Complex::Complex( double real, double imaginary )
{ setComplexNumber( real, imaginary ); }
Complex Complex::addition( const Complex &a )
{
Complex t;
t.realPart = realPart + a.realPart;
t.imaginaryPart = imaginaryPart + a.imaginaryPart;
return t;
}
Complex Complex::subtraction( const Complex &s )
{
Complex t(realPart - a.realPart, imaginaryPart - a.imaginaryPart);
return t;
}
void Complex::printComplex( void )
{ cout << '(' << realPart << ", " << imaginaryPart << ')'; }
void Complex::setComplexNumber( double rp, double ip )
{
realPart = rp;
imaginaryPart = ip;
}
//driver program
int main()
{
Complex b( 1, 7 ), c( 9, 2 );
Complex a;
b.printComplex();
cout << " + ";
c.printComplex();
cout << " = ";
a = b.addition(c);
a.printComplex();
cout << endl;
b.setComplexNumber( 10, 1 ); // reset realPart and imaginaryPart
c.setComplexNumber( 11, 5 );
b.printComplex();
cout << " - ";
c.printComplex();
cout << " = ";
a = b.subtraction(c);
a.printComplex();
cout << endl;
return 0;
}
```