--
#include<iostream.h>
#include<conio.h>
class complex
{
int real,img;
public:
void accept();
void show();
friend complex sum(complex,complex);
};
void complex::accept()
{
cout<<"\n Enter Numbers : ";
cout<<"\n Real : ";
cin>>real;
cout<<"\n Img : ";
cin>>img;
}
complex sum(complex c1,complex c2)
{
complex c3
c3.real=c1.real+c2.real;
c3.img =c1.img+c2.img;
return(c3);
}
void complex::show()
{
cout<<"\n real = "<
cout<<"\n Img = "<
}
void main()
{
complex c1,c2,c3;
clrscr();
c1.accept();
c2.accept();
c3=sum(c1,c2);
cout<<"\n-----------------------";
c3.show();
getch();
}
/*
OUTPUT
Enter Numbers :
Real : 120
Img : 111
Enter Numbers :
Real : 433
Img : 65
-----------------------
real = 553
Img = 117
*/