#include<iostream>
using namespace std;
class Complex{
private:
int imaginary, real;
public:
Complex(){
}
Complex(int m){
imaginary = m;
real = m;
}
Complex(int x, int m){
imaginary = m;
real = x;
}
Complex sum(Complex v, Complex w){
Complex a;
a.imaginary = v.imaginary + w.imaginary;
a.real = v.real + w.real;
return a;
}
void display(){
cout<<real<< "+"<<imaginary<<"i"<<endl;
}
};
int main(){
Complex v(5,7), d;
Complex w(6,7), a;
a = d.sum(v,w);
a.display();
}
Comments
Leave a comment