Define a complex number in c program:
class complex
{
private:
int real,ima;
public :
void input();
friend complex sum(complex,complex);
void show();
};
void complex:: show(void)
{
cout << "real part ="<< real << "\nThe imaginary part ="<
}
void complex ::input()
{
cout<<"enter the real and imaginary part\n";
cin >> real >> ima;
}
complex sum( complex a,complex b)
{
complex c;
c.real= a.real + b.real;
c.ima= a.ima + b.ima;
return c;
}
void main()
{
complex a,b,c;
clrscr();
a.input();
b.input();
c=sum(a,b);
c.show();
getch();
}