#include <iostream>
using namespace std; 
class complex
{
    float x, y; 
    public:
    void input (float real ,float image)
    {
        x=real;
        y=image;
    }
    friend complex sum(complex,complex);
    void show (complex);
};
complex sum(complex c1,complex c2)
{
    complex c3;
    c3.x=c1.x+c2.x;
    c3.y=c1.y+c2.y;
    return (c3);
}
void show (complex)
{
    complex c; 
    cout <<c. x<<"+j"<<c. y; 
}
int main() {
    complex A, B, C; 
    A. input (3.1,5.65);
    B. input (2.75,1.2);
    C=sum(A,B);
    cout <<"A= ";
    A. show (A);
    cout <<"B= ";
    B. show (B);
    cout <<"C= ";
    C. show (C);
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: