Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  complex
Language: C/C++
Code:
#include<iostream.h>
#include<conio.h>
class complex
{
 int r,i;
public: 
       void get()
{
       cin>>re>>i;
  }
   void disp()
{
  cout<<r<<"+"<<i<<"i";

};
void complex::add(complex c1,complex c2)
{
 r=c1.r+c2.r;
 i=c1.i+c2.i;
}
 int main()
 complex c1,c2,c3;
cout<<"enter 1st complex";
c1.get();
cout<<"enter 2nd complex";
c2.get();
c1.display();
c2.display();
c3.add(c1,c2);
display c3();
return 0;
getch();
}

          
          
          
          
          
          
Comments: