#include<iostream.h>
#include<conio.h>
Class complex
{
Float
real1, ima1,real2,ima2;
Float
res_real, res_ima;
Void
get_complex()
{
Cout<<”\n
Enter 1st complex no (2+3i should given as 2 3):”;
Cin>>real1>>ima1;
Cout<<”\n
Enter 2nd complex no (2+3i
should given as 2 3):”;
Cin>>real2>>ima2;
}
}
Void calc()
{
res_real=real1+real2;
res_ima=ima1+ima2;
}
Void
display()
{
Cout<<”\n
Resultant complex no : “
Cout<<”\n
Real part is : “<<res_real;
Cout<<”\n
Imaginary part is :”<<res_ima;
Cout<<”\n
Complex no is : “<<real<<”+”<<ima<<”i”;
}
};
Void main()
{
Clrscr();
Complex c;
c.get_complex();
c.calc();
c.display();
}
No comments:
Post a Comment